List of usage examples for java.awt GridBagConstraints HORIZONTAL
int HORIZONTAL
To view the source code for java.awt GridBagConstraints HORIZONTAL.
Click Source Link
From source file:ecosim.gui.SummaryPane.java
public SummaryPane(Summary summary) { this.summary = summary; setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); setLayout(new GridBagLayout()); // Setup the constraints for the GridBagLayout. GridBagConstraints northWest = new GridBagConstraints(0, 0, // gridx, gridy 1, 1, // gridwidth, gridheight 0.9D, 0.9D, // weightx, weighty GridBagConstraints.CENTER, // anchor GridBagConstraints.BOTH, // fill new Insets(0, 0, 0, 0), // insets 0, 0 // ipadx, ipady );/*from w w w. j ava2 s. c o m*/ GridBagConstraints northEast = new GridBagConstraints(1, 0, // gridx, gridy 1, 1, // gridwidth, gridheight 0.1D, 0.5D, // weightx, weighty GridBagConstraints.NORTH, // anchor GridBagConstraints.HORIZONTAL, // fill new Insets(0, 0, 0, 0), // insets 0, 0 // ipadx, ipady ); GridBagConstraints south = new GridBagConstraints(0, 1, // gridx, gridy 2, 1, // gridwidth, gridheight 1.0D, 0.1D, // weightx, weighty GridBagConstraints.SOUTH, // anchor GridBagConstraints.HORIZONTAL, // fill new Insets(0, 0, 0, 0), // insets 0, 0 // ipadx, ipady ); // Add everything to the summary pane. add(makeBinningChart(), northWest); add(makeTextPane(), northEast); add(makeTablePane(), south); }
From source file:com.sec.ose.osi.ui.dialog.progress.JDlgProgress.java
/** * This method initializes jPanelContent * //from w w w. ja va 2 s . c om * @return javax.swing.JPanel */ private JPanel getJPanelContent() { if (jPanelContent == null) { GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.weighty = 1.0; gridBagConstraints1.insets = new Insets(35, 25, 0, 25); gridBagConstraints1.gridx = 0; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints2.weightx = 1.0; gridBagConstraints2.weighty = 1.0; gridBagConstraints2.gridx = 0; gridBagConstraints2.insets = new Insets(35, 25, 0, 25); gridBagConstraints2.gridy = 1; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 0; gridBagConstraints3.insets = new Insets(20, 0, 20, 0); gridBagConstraints3.gridy = 2; jPanelContent = new JPanel(); jPanelContent.setLayout(new GridBagLayout()); jPanelContent.setPreferredSize(new Dimension(350, 150)); jPanelContent.add(getJTextAreaMessage(), gridBagConstraints1); jPanelContent.add(getJButtonCancel(), gridBagConstraints3); } return jPanelContent; }
From source file:interpolation.InteractiveRegression.java
public void Card() { CardLayout cl = new CardLayout(); panelCont.setLayout(cl);/*w w w . ja va2 s . c o m*/ panelCont.add(panelFirst, "1"); panelCont.add(panelSecond, "2"); panelFirst.setName("Regression Polynomial Fits"); /* Instantiation */ final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints c = new GridBagConstraints(); final Scrollbar degreeSB = new Scrollbar(Scrollbar.HORIZONTAL, this.degreeInt, 1, MIN_SLIDER, MAX_SLIDER + 1); final Label degreeLabel = new Label("Degree of polynomial = " + this.degree, Label.CENTER); // Location panelFirst.setLayout(layout); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 1; ++c.gridy; c.insets = new Insets(30, 150, 0, 150); panelFirst.add(degreeSB, c); ++c.gridy; c.insets = new Insets(30, 150, 0, 150); panelFirst.add(degreeLabel, c); degreeSB.addAdjustmentListener(new DegreeListener(this, degreeLabel, degreeSB)); panelFirst.setVisible(true); cl.show(panelCont, "1"); Cardframe.add(panelCont, BorderLayout.CENTER); Cardframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Cardframe.pack(); Cardframe.setVisible(true); updateRegression(); }
From source file:be.ac.ua.comp.scarletnebula.gui.ServerCellRenderer.java
@Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { // Dirty hack: the last item in the serverlist is always a fake server // that when double clicked produces an "add new server" wizard. if (value == null) { return getNewServerServer(list, index, isSelected); }//from w w w. j a v a 2s. com final Server server = (Server) value; final JPanel p = createServerPanel(server, list, index, isSelected); final Color foreground = getForegroundColor(list, index, isSelected); final JLabel label = getServernameComponent(server, foreground); final JLabel tags = getTagComponent(server, foreground); // final ChartPanel chartPanel = getChartPanelComponent(); final GraphPanelCache gcp = GraphPanelCache.get(); final Component chartOrNothing; if (server.getServerStatistics() == null) { chartOrNothing = new JLabel(); } else { chartOrNothing = gcp.inBareServerCache(server) ? gcp.getBareChartPanel(server) : createAndStoreBareChartPanel(list, server); } p.setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; c.gridx = 0; c.gridy = 0; c.insets = new Insets(5, 5, 1, 5); c.anchor = GridBagConstraints.FIRST_LINE_START; p.add(label, c); c.insets = new Insets(0, 5, 5, 5); c.gridy = 1; p.add(tags, c); c.fill = GridBagConstraints.BOTH; c.weighty = 1.0; c.gridy = 2; p.add(chartOrNothing, c); return p; }
From source file:com.adito.upgrade.GUIUpgrader.java
public GUIUpgrader() { super(new BorderLayout()); JPanel info = new JPanel(new BorderLayout(2, 2)); // info.setBackground(Color.white); // info.setForeground(Color.black); // info.setOpaque(true); info.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); JLabel l = new JLabel("<html><p>This utility upgrades configuration from " + "one version 0.1.16 installation to another " + "0.2.5+ installation. You may choose which resources you " + "wish to be copied. If resources with the same name already " + "exist they will be left as is."); l.setIcon(new ImageIcon(GUIUpgrader.class.getResource("upgrader-48x48.png"))); info.add(l, BorderLayout.CENTER); info.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); mainPanel = new JPanel(new BorderLayout()); add(info, BorderLayout.NORTH); add(mainPanel, BorderLayout.CENTER); // Installations panel JPanel installations = new JPanel(new GridBagLayout()); installations.setBorder(BorderFactory.createTitledBorder("Installations")); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 2.0;//w w w . jav a 2s .com UIUtil.jGridBagAdd(installations, new JLabel("Source"), gbc, GridBagConstraints.REMAINDER); gbc.weightx = 1.0; source = new JTextField(); source.getDocument().addDocumentListener(this); UIUtil.jGridBagAdd(installations, source, gbc, GridBagConstraints.RELATIVE); browseSource = new JButton("Browse"); browseSource.setMnemonic('b'); browseSource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(source.getText()); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setDialogTitle("Select source installation directory (0.16.1)"); if (chooser.showOpenDialog(GUIUpgrader.this) == JFileChooser.APPROVE_OPTION) { source.setText(chooser.getSelectedFile().getAbsolutePath()); } } }); gbc.weightx = 0.0; UIUtil.jGridBagAdd(installations, browseSource, gbc, GridBagConstraints.REMAINDER); gbc.weightx = 2.0; UIUtil.jGridBagAdd(installations, new JLabel("Target"), gbc, GridBagConstraints.REMAINDER); gbc.weightx = 1.0; target = new JTextField(System.getProperty("user.dir")); target.getDocument().addDocumentListener(this); UIUtil.jGridBagAdd(installations, target, gbc, GridBagConstraints.RELATIVE); browseTarget = new JButton("Browse"); browseTarget.setMnemonic('r'); browseTarget.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(target.getText()); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setDialogTitle("Select target installation directory (0.2.5+)"); if (chooser.showOpenDialog(GUIUpgrader.this) == JFileChooser.APPROVE_OPTION) { target.setText(chooser.getSelectedFile().getAbsolutePath()); } } }); gbc.weightx = 0.0; UIUtil.jGridBagAdd(installations, browseTarget, gbc, GridBagConstraints.REMAINDER); mainPanel.add(installations, BorderLayout.NORTH); // Upgrade selection upgradeSelectionPanel = new JPanel(); upgradeSelectionPanel.setBorder(BorderFactory.createTitledBorder("Upgrades")); upgradeSelectionPanel.setLayout(new BoxLayout(upgradeSelectionPanel, BoxLayout.Y_AXIS)); mainPanel.add(upgradeSelectionPanel, BorderLayout.CENTER); }
From source file:com.sshtools.common.ui.HostsTab.java
/** * Creates a new HostsTab object.//from ww w .j av a 2s . c o m * * @param hostKeyVerifier */ public HostsTab(AbstractKnownHostsKeyVerification hostKeyVerifier) { super(); this.hostKeyVerifier = hostKeyVerifier; hosts = new JList(model = new HostsListModel()); hosts.setVisibleRowCount(10); hosts.setCellRenderer(new HostRenderer()); hosts.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { setAvailableActions(); } }); remove = new JButton("Remove", new ResourceIcon(REMOVE_ICON)); remove.addActionListener(this); //deny = new JButton("Deny", new ResourceIcon(DENY_ICON)); //deny.addActionListener(this); JPanel b = new JPanel(new GridBagLayout()); b.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 0, 4, 0); gbc.anchor = GridBagConstraints.NORTH; gbc.weightx = 1.0; UIUtil.jGridBagAdd(b, remove, gbc, GridBagConstraints.REMAINDER); gbc.weighty = 1.0; //UIUtil.jGridBagAdd(b, deny, gbc, GridBagConstraints.REMAINDER); JPanel s = new JPanel(new BorderLayout()); s.add(new JScrollPane(hosts), BorderLayout.CENTER); s.add(b, BorderLayout.EAST); IconWrapperPanel w = new IconWrapperPanel(new ResourceIcon(GLOBAL_ICON), s); // This tab setLayout(new BorderLayout()); add(w, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); reset(); }
From source file:EditorPaneExample11.java
public EditorPaneExample11() { super("JEditorPane Example 11"); pane = new JEditorPane(); pane.setEditable(false); // Read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;/*from w w w . j ava 2 s.c o m*/ c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridy = 3; panel.add(new JLabel(LOAD_TIME), c); c.gridy = 4; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; onlineLoad = new JCheckBox("Online Load"); panel.add(onlineLoad, c); onlineLoad.setSelected(true); onlineLoad.setForeground(typeLabel.getForeground()); c.gridx = 1; c.gridy = 0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; urlCombo = new JComboBox(); panel.add(urlCombo, c); urlCombo.setEditable(true); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); timeLabel = new JLabel(""); c.gridy = 3; panel.add(timeLabel, c); getContentPane().add(panel, "South"); // Allocate the empty tree model DefaultMutableTreeNode emptyRootNode = new DefaultMutableTreeNode("Empty"); emptyModel = new DefaultTreeModel(emptyRootNode); // Create and place the heading tree tree = new JTree(emptyModel); tree.setPreferredSize(new Dimension(200, 200)); getContentPane().add(new JScrollPane(tree), "East"); // Change page based on combo selection urlCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (populatingCombo == true) { return; } Object selection = urlCombo.getSelectedItem(); try { // Check if the new page and the old // page are the same. URL url; if (selection instanceof URL) { url = (URL) selection; } else { url = new URL((String) selection); } URL loadedURL = pane.getPage(); if (loadedURL != null && loadedURL.sameFile(url)) { return; } // Try to display the page urlCombo.setEnabled(false); // Disable input urlCombo.paintImmediately(0, 0, urlCombo.getSize().width, urlCombo.getSize().height); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Busy cursor loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); timeLabel.setText(""); timeLabel.paintImmediately(0, 0, timeLabel.getSize().width, timeLabel.getSize().height); // Display an empty tree while loading tree.setModel(emptyModel); tree.paintImmediately(0, 0, tree.getSize().width, tree.getSize().height); startTime = System.currentTimeMillis(); // Choose the loading method if (onlineLoad.isSelected()) { // Usual load via setPage pane.setPage(url); loadedType.setText(pane.getContentType()); } else { pane.setContentType("text/html"); loadedType.setText(pane.getContentType()); if (loader == null) { loader = new HTMLDocumentLoader(); } HTMLDocument doc = loader.loadDocument(url); loadComplete(); pane.setDocument(doc); displayLoadTime(); populateCombo(findLinks(doc, null)); TreeNode node = buildHeadingTree(doc); tree.setModel(new DefaultTreeModel(node)); enableInput(); } } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", selection.toString() }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); enableInput(); } } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadComplete(); displayLoadTime(); populateCombo(findLinks(pane.getDocument(), null)); TreeNode node = buildHeadingTree(pane.getDocument()); tree.setModel(new DefaultTreeModel(node)); enableInput(); } } }); // Listener for tree selection tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent evt) { TreePath path = evt.getNewLeadSelectionPath(); if (path != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); Object userObject = node.getUserObject(); if (userObject instanceof Heading) { Heading heading = (Heading) userObject; try { Rectangle textRect = pane.modelToView(heading.getOffset()); textRect.y += 3 * textRect.height; pane.scrollRectToVisible(textRect); } catch (BadLocationException e) { } } } } }); }
From source file:ShowDocument.java
public URLWindow(AppletContext appletContext) { super("Show a Document!"); this.appletContext = appletContext; JPanel contentPane = new JPanel(new GridBagLayout()); setContentPane(contentPane);//w ww .j a v a2 s . c om contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; JLabel label1 = new JLabel("URL of document to show: ", JLabel.TRAILING); add(label1, c); urlField = new JTextField("http://java.sun.com/", 20); label1.setLabelFor(urlField); urlField.addActionListener(this); c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0; add(urlField, c); JLabel label2 = new JLabel("Window/frame to show it in: ", JLabel.TRAILING); c.gridwidth = 1; c.weightx = 0.0; add(label2, c); String[] strings = { "(browser's choice)", //don't specify "My Personal Window", //a window named "My Personal Window" "_blank", //a new, unnamed window "_self", "_parent", "_top" //the Frame that contained this applet }; choice = new JComboBox(strings); label2.setLabelFor(choice); c.fill = GridBagConstraints.NONE; c.gridwidth = GridBagConstraints.REMAINDER; c.insets = new Insets(5, 0, 0, 0); c.anchor = GridBagConstraints.LINE_START; add(choice, c); JButton button = new JButton("Show document"); button.addActionListener(this); c.weighty = 1.0; c.ipadx = 10; c.ipady = 10; c.insets = new Insets(10, 0, 0, 0); c.anchor = GridBagConstraints.PAGE_END; add(button, c); }
From source file:SimpleAuthenticator.java
protected PasswordAuthentication getPasswordAuthentication() { // given a prompt? String prompt = getRequestingPrompt(); if (prompt == null) prompt = "Please login..."; // protocol//from www . j a v a 2s.c o m String protocol = getRequestingProtocol(); if (protocol == null) protocol = "Unknown protocol"; // get the host String host = null; InetAddress inet = getRequestingSite(); if (inet != null) host = inet.getHostName(); if (host == null) host = "Unknown host"; // port String port = ""; int portnum = getRequestingPort(); if (portnum != -1) port = ", port " + portnum + " "; // Build the info string String info = "Connecting to " + protocol + " mail service on host " + host + port; //JPanel d = new JPanel(); // XXX - for some reason using a JPanel here causes JOptionPane // to display incorrectly, so we workaround the problem using // an anonymous JComponent. JComponent d = new JComponent() { }; GridBagLayout gb = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); d.setLayout(gb); c.insets = new Insets(2, 2, 2, 2); c.anchor = GridBagConstraints.WEST; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0.0; d.add(constrain(new JLabel(info), gb, c)); d.add(constrain(new JLabel(prompt), gb, c)); c.gridwidth = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; d.add(constrain(new JLabel("Username:"), gb, c)); c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0; String user = getDefaultUserName(); JTextField username = new JTextField(user, 20); d.add(constrain(username, gb, c)); c.gridwidth = 1; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.EAST; c.weightx = 0.0; d.add(constrain(new JLabel("Password:"), gb, c)); c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1.0; JPasswordField password = new JPasswordField("", 20); d.add(constrain(password, gb, c)); // XXX - following doesn't work if (user != null && user.length() > 0) password.requestFocus(); else username.requestFocus(); int result = JOptionPane.showConfirmDialog(frame, d, "Login", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result == JOptionPane.OK_OPTION) return new PasswordAuthentication(username.getText(), password.getText()); else return null; }
From source file:com.game.ui.views.MapEditor.java
public void generateGUI() throws IOException { setDefaultCloseOperation(DISPOSE_ON_CLOSE); // setResizable(false); JMenuBar menubar = new JMenuBar(); ImageIcon icon = null;// w ww. j a va 2 s .com try { icon = GameUtils.shrinkImage("save.png", 20, 20); } catch (IOException e) { System.out.println("Dialog : showDialogForMap(): Exception occured :" + e); e.printStackTrace(); } JMenu file = new JMenu("File"); JMenuItem save = new JMenuItem("Save", icon); save.setToolTipText("Save Map Information"); save.setActionCommand("Save Map"); save.addActionListener(this); file.add(save); menubar.add(file); setJMenuBar(menubar); JPanel topPanel = new JPanel(); topPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); topPanel.setLayout(new GridBagLayout()); JLabel headerLbl = new JLabel("Legend : "); headerLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); JLabel lbl1 = new JLabel(); lbl1.setPreferredSize(new Dimension(50, 20)); lbl1.setBackground(Configuration.pathColor); lbl1.setOpaque(true); JLabel lbl2 = new JLabel("- Represents the path."); JLabel lbl3 = new JLabel(); lbl3.setPreferredSize(new Dimension(50, 20)); lbl3.setBackground(Configuration.enemyColor); lbl3.setOpaque(true); JLabel lbl4 = new JLabel("- Represents the path with monsters"); JLabel lbl5 = new JLabel(); lbl5.setPreferredSize(new Dimension(50, 20)); lbl5.setBackground(Configuration.startPointColor); lbl5.setOpaque(true); JLabel lbl6 = new JLabel("- Represents the starting point in the path"); JLabel lbl7 = new JLabel(); lbl7.setBackground(Configuration.endPointColor); lbl7.setOpaque(true); lbl7.setPreferredSize(new Dimension(50, 20)); JLabel lbl8 = new JLabel("- Ending point in the path"); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.weightx = 1; c.weighty = 0; c.insets = new Insets(5, 5, 5, 5); c.gridwidth = 2; topPanel.add(headerLbl, c); c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 1; c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.ipadx = 5; c.ipady = 5; topPanel.add(lbl1, c); c.gridx = 1; c.anchor = GridBagConstraints.FIRST_LINE_START; topPanel.add(lbl2, c); c.gridx = 0; c.gridy = 2; topPanel.add(lbl3, c); c.gridx = 1; topPanel.add(lbl4, c); c.gridx = 0; c.gridy = 3; topPanel.add(lbl5, c); c.gridx = 1; topPanel.add(lbl6, c); c.gridx = 0; c.gridy = 4; topPanel.add(lbl7, c); c.gridx = 1; topPanel.add(lbl8, c); add(topPanel, BorderLayout.NORTH); bottomPanel = new JPanel(); add(bottomPanel, BorderLayout.CENTER); bottomPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); // bottomPanel.add(new JButton("kaushik")); pack(); setExtendedState(JFrame.MAXIMIZED_BOTH); GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); setMaximizedBounds(env.getMaximumWindowBounds()); setVisible(true); callDialogForUsersInput(); }