List of usage examples for java.awt GridBagConstraints GridBagConstraints
public GridBagConstraints()
From source file:com.sec.ose.osi.ui.frm.main.manage.dialog.JDlgProjectCreate.java
/** * This method initializes jPanelPjtName * // w w w .j a va 2s. c om * @return javax.swing.JPanel */ private JPanel getJPanelPjtName() { if (jPanelPjtName == null) { GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.insets = new Insets(10, 10, 0, 0); gridBagConstraints.ipadx = 4; gridBagConstraints.gridy = 0; jLabelNewProjectName = new JLabel(); jLabelNewProjectName.setText("New Project Name :"); GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.anchor = GridBagConstraints.CENTER; gridBagConstraints7.insets = new Insets(10, 10, 10, 0); gridBagConstraints7.gridwidth = 1; gridBagConstraints7.gridx = 1; gridBagConstraints7.gridy = 1; gridBagConstraints7.weightx = 0.1; gridBagConstraints7.fill = GridBagConstraints.HORIZONTAL; GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.anchor = GridBagConstraints.EAST; gridBagConstraints6.gridx = 0; gridBagConstraints6.gridy = 1; gridBagConstraints6.ipadx = 0; gridBagConstraints6.insets = new Insets(10, 10, 10, 0); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 2; gridBagConstraints2.insets = new Insets(10, 10, 0, 10); gridBagConstraints2.fill = GridBagConstraints.NONE; gridBagConstraints2.gridy = 0; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 0.1; gridBagConstraints1.gridwidth = 1; gridBagConstraints1.insets = new Insets(10, 10, 0, 0); gridBagConstraints1.gridx = 1; jPanelPjtName = new JPanel(); jPanelPjtName.setLayout(new GridBagLayout()); jPanelPjtName.setPreferredSize(new Dimension(500, 200)); jPanelPjtName.setBorder(BorderFactory.createTitledBorder(null, "Project Name", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelPjtName.add(getJTextFieldNewProjectName(), gridBagConstraints1); jPanelPjtName.add(getJButtonCheck(), gridBagConstraints2); jPanelPjtName.add(getJCheckBoxClonedFrom(), gridBagConstraints6); jPanelPjtName.add(getJComboBoxClonedFrom(), gridBagConstraints7); jPanelPjtName.add(jLabelNewProjectName, gridBagConstraints); } return jPanelPjtName; }
From source file:com.googlecode.vfsjfilechooser2.accessories.connection.ConnectionDialog.java
private void makeGridPanel(Component[] components) { final Insets insets = new Insets(5, 5, 5, 5); final GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0;//from w w w .j a v a 2 s . c o m gbc.weighty = 1.0; gbc.insets = insets; gbc.ipadx = 0; gbc.ipady = 0; gbc.anchor = GridBagConstraints.EAST; gbc.fill = GridBagConstraints.HORIZONTAL; int i = 0; int j = 0; for (Component component : components) { gbc.gridx = i; gbc.gridy = j; gbc.gridwidth = 1; gbc.gridheight = 1; centerPanel.add(component, gbc); i++; // 2 components per row if ((i % 2) == 0) { j++; i = 0; } } }
From source file:gov.loc.repository.bagger.ui.NewBagFrame.java
private void layoutProfileSelection(JPanel contentPane, int row) { // content// ww w .j a va2 s .co m // profile selection JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:")); bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); profileList = new JComboBox(bagView.getProfileStore().getProfileNames()); profileList.setName(bagView.getPropertyMessage("bag.label.projectlist")); profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject")); profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); GridBagConstraints glbc = new GridBagConstraints(); JLabel spacerLabel = new JLabel(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); contentPane.add(bagProfileLabel, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); contentPane.add(profileList, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPane.add(spacerLabel, glbc); }
From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java
/** * This method initializes this//from ww w . j a v a2 s . c o m * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.gridx = 0; gridBagConstraints12.anchor = GridBagConstraints.WEST; gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints12.gridwidth = 2; gridBagConstraints12.weightx = 0.0; gridBagConstraints12.gridy = 1; GridBagConstraints gridBagConstraints23 = new GridBagConstraints(); gridBagConstraints23.fill = GridBagConstraints.BOTH; gridBagConstraints23.weighty = 1.0; gridBagConstraints23.gridwidth = 1; gridBagConstraints23.weightx = 1.0; jLabelComponentForOpt1 = new JLabel(); jLabelComponentForOpt1.setText("(Option) Component :"); jLabelComponentForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelLicenseForOpt1 = new JLabel(); jLabelLicenseForOpt1.setText("License :"); jLabelLicenseForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelRepresentativeLicenseForOpt2 = new JLabel(); jLabelRepresentativeLicenseForOpt2.setText("Representative License :"); jLabelRepresentativeLicenseForOpt2.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelNoticeForOpt1 = new JLabel(); jLabelNoticeForOpt1.setText( "Note) If you don't choose a component, it will be identified by \"DECLARED_STRING_MATCH_LICENSE_\" + \"License Name\"."); jLabelNoticeForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12)); this.setSize(570, 480); this.setLayout(new GridBagLayout()); this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); // matched code view & license match info table this.add(getJSplitPaneCodeAndTable(), gridBagConstraints23); // option this.add(getJScrollPanelOptions(), gridBagConstraints12); }
From source file:com.sec.ose.osi.ui.frm.main.manage.dialog.JDlgProjectAdd.java
/** * This method initializes jPanelPjtList * /*w w w. ja v a 2s . com*/ * @return javax.swing.JPanel */ private JPanel getJPanelPjtList() { if (jPanelPjtList == null) { GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridy = 1; gridBagConstraints3.fill = GridBagConstraints.BOTH; gridBagConstraints3.gridwidth = 2; gridBagConstraints3.weighty = 0.1; gridBagConstraints3.insets = new Insets(0, 10, 10, 10); gridBagConstraints3.ipadx = 0; gridBagConstraints3.weightx = 0.1; gridBagConstraints3.gridx = 0; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.insets = new Insets(10, 10, 10, 0); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 0.1; gridBagConstraints1.insets = new Insets(10, 10, 10, 10); gridBagConstraints1.ipadx = 0; gridBagConstraints1.ipady = 0; gridBagConstraints1.gridx = 1; jLabelFilter = new JLabel(); jLabelFilter.setText("Filter :"); jPanelPjtList = new JPanel(); jPanelPjtList.setLayout(new GridBagLayout()); jPanelPjtList.setBorder(BorderFactory.createTitledBorder(null, "Project List", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanelPjtList.add(jLabelFilter, gridBagConstraints2); jPanelPjtList.add(getJTextFieldFilter(), gridBagConstraints1); jPanelPjtList.add(getJScrollPanePjtList(), gridBagConstraints3); } return jPanelPjtList; }
From source file:de.topobyte.livecg.LiveCG.java
public void setup(boolean exitOnClose, Content content) { frame.setSize(800, 600);/* w w w . j a v a 2 s .c o m*/ if (exitOnClose) { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } frame.setTitle("Live CG"); GeometryEditor geometryEditor = new GeometryEditor(); Menu menu = new Menu(this, geometryEditor.getEditPane(), geometryEditor.getEditPane()); Toolbar toolbar = new Toolbar(geometryEditor.getEditPane(), geometryEditor.getEditPane()); toolbar.setFloatable(false); StatusBar statusBar = new StatusBar(); StatusBarMouseListener statusBarMouseListener = new StatusBarMouseListener(geometryEditor.getEditPane(), statusBar); geometryEditor.getEditPane().addMouseListener(statusBarMouseListener); geometryEditor.getEditPane().addMouseMotionListener(statusBarMouseListener); GridBagConstraints c = new GridBagConstraints(); JPanel mainPanel = new JPanel(new GridBagLayout()); frame.setJMenuBar(menu); frame.setContentPane(mainPanel); c.weightx = 1.0; c.fill = GridBagConstraints.BOTH; c.gridy = 0; c.weighty = 0.0; mainPanel.add(toolbar, c); c.gridy = 1; c.weighty = 1.0; mainPanel.add(geometryEditor, c); c.gridy = 2; c.weighty = 0.0; mainPanel.add(statusBar, c); frame.setLocationByPlatform(true); frame.setVisible(true); objectDialog = new ObjectDialog(frame, geometryEditor.getEditPane()); objectDialog.setSize(300, 300); contentDialog = new ContentDialog(frame, geometryEditor.getEditPane()); contentDialog.setSize(300, 300); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (showObjectDialog) { showObjectDialog(); } if (showContentDialog) { showContentDialog(); } } }); if (content != null) { geometryEditor.getEditPane().setContent(content); } }
From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java
/** * Description:/*w w w .ja v a2 s . co m*/ * * @param name */ protected void initComponent() { setLayout(new GridBagLayout()); setOpaque(false); setBorder(BorderFactory.createTitledBorder((Border) null)); GridBagConstraints gc = new GridBagConstraints(); gc.fill = GridBagConstraints.BOTH; gc.weightx = 1; gc.gridwidth = GridBagConstraints.REMAINDER; JPanel titlePanel = createTitlePanel(); add(titlePanel, gc); gc.gridwidth = 1; JPanel deviceTypePanel = createDeviceTypePanel(); add(deviceTypePanel, gc); gc.gridwidth = GridBagConstraints.REMAINDER; JPanel flowTypePanel = createFlowTypePanel(); add(flowTypePanel, gc); gc.weighty = 1; gc.fill = GridBagConstraints.BOTH; add(Box.createGlue(), gc); }
From source file:com.vgi.mafscaling.ClosedLoop.java
protected void createRunPanel(JPanel dataPanel) { JPanel runPanel = new JPanel(); GridBagConstraints gbc_runPanel = new GridBagConstraints(); gbc_runPanel.fill = GridBagConstraints.BOTH; gbc_runPanel.weightx = 1.0;/*from w ww . j a v a 2 s . c om*/ gbc_runPanel.weighty = 1.0; gbc_runPanel.gridx = 0; gbc_runPanel.gridy = 3; dataPanel.add(runPanel, gbc_runPanel); GridBagLayout gbl_runPanel = new GridBagLayout(); gbl_runPanel.columnWidths = new int[] { 0, 0 }; gbl_runPanel.rowHeights = new int[] { 0 }; gbl_runPanel.columnWeights = new double[] { 0.0, 0.0 }; gbl_runPanel.rowWeights = new double[] { 0.0 }; runPanel.setLayout(gbl_runPanel); JScrollPane dataScrollPane = new JScrollPane(); createLogDataTable(dataScrollPane); GridBagConstraints gbc_dataScrollPane = new GridBagConstraints(); gbc_dataScrollPane.fill = GridBagConstraints.BOTH; gbc_dataScrollPane.ipadx = ColumnWidth * ColumnCount; gbc_dataScrollPane.weighty = 1.0; gbc_dataScrollPane.gridx = 0; gbc_dataScrollPane.gridy = 0; runPanel.add(dataScrollPane, gbc_dataScrollPane); JScrollPane aprScrollPane = new JScrollPane(); createAfrDataTables(aprScrollPane); GridBagConstraints gbc_aprScrollPane = new GridBagConstraints(); gbc_aprScrollPane.weightx = 1.0; gbc_aprScrollPane.weighty = 1.0; gbc_aprScrollPane.anchor = GridBagConstraints.PAGE_START; gbc_aprScrollPane.fill = GridBagConstraints.BOTH; gbc_aprScrollPane.gridx = 1; gbc_aprScrollPane.gridy = 0; runPanel.add(aprScrollPane, gbc_aprScrollPane); }
From source file:com.sshtools.common.ui.SshToolsConnectionPanel.java
/** * * * @param parent/*from w w w. j av a2 s . c om*/ * @param profile * @param optionalTabs * * @return */ public static SshToolsConnectionProfile showConnectionDialog(Component parent, SshToolsConnectionProfile profile, SshToolsConnectionTab[] optionalTabs) { // If no properties are provided, then use the default if (profile == null) { int port = DEFAULT_PORT; String port_S = Integer.toString(DEFAULT_PORT); port_S = PreferencesStore.get(SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT, port_S); try { port = Integer.parseInt(port_S); } catch (NumberFormatException e) { log.warn("Could not parse the port number from defaults file (property name" + SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT + ", property value= " + port_S + ")."); } profile = new SshToolsConnectionProfile(); profile.setHost(PreferencesStore.get(SshToolsApplication.PREF_CONNECTION_LAST_HOST, "")); profile.setPort(PreferencesStore.getInt(SshToolsApplication.PREF_CONNECTION_LAST_PORT, port)); profile.setUsername(PreferencesStore.get(SshToolsApplication.PREF_CONNECTION_LAST_USER, "")); } final SshToolsConnectionPanel conx = new SshToolsConnectionPanel(true); if (optionalTabs != null) { for (int i = 0; i < optionalTabs.length; i++) { conx.addTab(optionalTabs[i]); } } conx.setConnectionProfile(profile); JDialog d = null; Window w = (Window) SwingUtilities.getAncestorOfClass(Window.class, parent); if (w instanceof JDialog) { d = new JDialog((JDialog) w, "Connection Profile", true); } else if (w instanceof JFrame) { d = new JDialog((JFrame) w, "Connection Profile", true); } else { d = new JDialog((JFrame) null, "Connection Profile", true); } final JDialog dialog = d; class UserAction { boolean connect; } final UserAction userAction = new UserAction(); // Create the bottom button panel final JButton cancel = new JButton("Cancel"); cancel.setMnemonic('c'); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { userAction.connect = false; dialog.setVisible(false); } }); final JButton connect = new JButton("Connect"); connect.setMnemonic('t'); connect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (conx.validateTabs()) { userAction.connect = true; dialog.setVisible(false); } } }); dialog.getRootPane().setDefaultButton(connect); JPanel buttonPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(6, 6, 0, 0); gbc.weighty = 1.0; UIUtil.jGridBagAdd(buttonPanel, connect, gbc, GridBagConstraints.RELATIVE); UIUtil.jGridBagAdd(buttonPanel, cancel, gbc, GridBagConstraints.REMAINDER); JPanel southPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0)); southPanel.add(buttonPanel); // JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPanel.add(conx, BorderLayout.CENTER); mainPanel.add(southPanel, BorderLayout.SOUTH); // Show the dialog dialog.getContentPane().setLayout(new GridLayout(1, 1)); dialog.getContentPane().add(mainPanel); dialog.pack(); dialog.setResizable(false); UIUtil.positionComponent(SwingConstants.CENTER, dialog); //show the simple box and act on the answer. SshToolsSimpleConnectionPrompt stscp = SshToolsSimpleConnectionPrompt.getInstance(); StringBuffer sb = new StringBuffer(); userAction.connect = !stscp.getHostname(sb, profile.getHost()); boolean advanced = stscp.getAdvanced(); if (advanced) { userAction.connect = false; profile.setHost(sb.toString()); conx.hosttab.setConnectionProfile(profile); dialog.setVisible(true); } // Make sure we didn't cancel if (!userAction.connect) { return null; } conx.applyTabs(); if (!advanced) profile.setHost(sb.toString()); if (!advanced) { int port = DEFAULT_PORT; String port_S = Integer.toString(DEFAULT_PORT); port_S = PreferencesStore.get(SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT, port_S); try { port = Integer.parseInt(port_S); } catch (NumberFormatException e) { log.warn("Could not parse the port number from defaults file (property name" + SshTerminalPanel.PREF_DEFAULT_SIMPLE_PORT + ", property value= " + port_S + ")."); } profile.setPort(port); } if (!advanced) profile.setUsername(""); PreferencesStore.put(SshToolsApplication.PREF_CONNECTION_LAST_HOST, profile.getHost()); // only save user inputed configuration if (advanced) { PreferencesStore.put(SshToolsApplication.PREF_CONNECTION_LAST_USER, profile.getUsername()); PreferencesStore.putInt(SshToolsApplication.PREF_CONNECTION_LAST_PORT, profile.getPort()); } // Return the connection properties return profile; }
From source file:net.sf.profiler4j.console.ClassListPanel.java
/** * This method initializes bottomPanel/*www. j a v a2 s. c om*/ * * @return javax.swing.JPanel */ private JPanel getBottomPanel() { if (bottomPanel == null) { GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.gridx = 2; gridBagConstraints12.insets = new java.awt.Insets(4, 4, 4, 4); gridBagConstraints12.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints12.gridy = 0; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 5; gridBagConstraints11.insets = new java.awt.Insets(8, 4, 8, 8); gridBagConstraints11.gridy = 0; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.insets = new java.awt.Insets(8, 4, 8, 4); gridBagConstraints3.gridy = 0; gridBagConstraints3.gridx = 4; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.insets = new java.awt.Insets(8, 4, 8, 4); gridBagConstraints2.gridy = 0; gridBagConstraints2.gridx = 3; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.gridx = 1; gridBagConstraints1.gridy = 0; gridBagConstraints1.weightx = 1.0; gridBagConstraints1.insets = new java.awt.Insets(4, 4, 4, 4); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(4, 8, 4, 4); gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.gridx = 0; jLabel = new JLabel(); jLabel.setText("Filter: "); bottomPanel = new JPanel(); bottomPanel.setLayout(new GridBagLayout()); bottomPanel.add(jLabel, gridBagConstraints); bottomPanel.add(getFilterTextField(), gridBagConstraints1); bottomPanel.add(getClearButton(), gridBagConstraints2); bottomPanel.add(getRefreshButton(), gridBagConstraints3); bottomPanel.add(getAddAsRuleButton(), gridBagConstraints11); bottomPanel.add(getOnlyInstrumentedCheckBox(), gridBagConstraints12); } return bottomPanel; }