Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8293569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:52:17+00:00 2026-06-08T13:52:17+00:00

I created a form to choose a database service such as SQL server and

  • 0

I created a form to choose a database service such as SQL server and Oracle, and its version .then connect to it by clicking the Connect button….but before connection is made, some parameters should be set in order to place in URL…this code is for the Connect button.

jButton2 = new JButton();
getContentPane().add(jButton2);
jButton2.setText("Connect");
jButton2.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent evt){
            LinkedFrame inst = new LinkedFrame();
            inst.setLocationRelativeTo(rootPane);
            inst.setVisible(true);
//Question:  Should I add any method here to do what I want? , and what method should I add?
            }
                    });
        }

this is the LinkedFrame code(extended from JFrame):

    private class DatabaseSelectionHandler implements ActionListener{
    public void actionPerformed(ActionEvent evt){
        database=jTextField1.getText();
        username=jTextField2.getText();
        pass=new String(jPasswordField1.getPassword());
        if(database.isEmpty() || username.isEmpty() || pass.isEmpty())
            JOptionPane.showMessageDialog(null, "Please fill all fields", "Error", JOptionPane.ERROR_MESSAGE);
        else
        {   setVisible(false);
            if (service.equalsIgnoreCase("sqlserver"))
                Connector.MSSQLConnection(service);//Single tone connectioto SQL Server
            else
                Connector.ORACLEConnection(service);//Single tone connection to Oracle
//Question:  Should I add any method here to do what I want? , and what method should I add?
        }
    }       
}

LinkedFrame is a new form for gathering required information including DB name, Username and Password. these information should be passed to MSSQLconnect or OracleConnect methods fo the Connector Class.In this this form is created as you click the button and disappears as you fill in the fields all and press enter…(see the code above)

Now I have some questions:

I want to resize my main frame(not linkedframe) as soon as I fill in the blanks and heat the ENTER and if the connection is made in order to make queries.

  1. What method of JFrame should I use?

  2. where should the method be placed(in the button event handler of main frame or in the event handler of Linkedframe or anywhere suggested)?

Thanks a lot in advance for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T13:52:18+00:00Added an answer on June 8, 2026 at 1:52 pm

    Without more code it may be difficult for us to provide you with a complete answer, but I’ll have a go.

    Using a static Connector is fine so long as you NEVER want more then one connection at a time. No issue there really. If you did however, you would need to pass a Connector to the LinkedFrame, either as part of the constructor or as property, but that’s a design choice.

    For the LinkedFrame, I would use JDialog set to be modal. This will block the user input until the close the dialog. This also means that you can show the dialog and your code will be blocked until the dialog is closed. This provides you a “trap” in your code.

    Once the user provides the information you want from the LinkedFrame and closes the dialog, you can extract the details you need (if any) and resize your master frame accordingly.

    Update

    public void actionPerformed(ActionEvent evt) {
    
        LinkedFrame linkedFrame = new LinkedFrame(); // create the dialog, set as modal
        linkedFrame.setVisible(true); // code will block here till you close the dialog
    
        setSize(width, height); // supply the width & height you want
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a form with a label, textbox and a button. In the form
I created a form application with 1 button and 1 text box to see
I created a FontDialog.cs Windows Form where my users can choose colors among other
I have a SQL Server 2008 DBMS, and I have created an EDM (generated
I am trying to using a jquery.validate.unotrusive.js plugin to dynamically created form fields like:
I created a form in CodeIgniter framework that successfully uploads an image using the
I created a form that overlays on top of another form in an alpha
I created a form using Swing in Java. In the form I have used
I created a Form application in visual c#, that uses a function to generate
I'd created a form in Visual Studio 2010. Somehow my computer was restarted. After

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.