List of usage examples for java.awt GridBagConstraints NORTHWEST
int NORTHWEST
To view the source code for java.awt GridBagConstraints NORTHWEST.
Click Source Link
From source file:com.sshtools.common.ui.SshToolsConnectionHostTab.java
/** * Creates a new SshToolsConnectionHostTab object. *///w w w. j a v a 2 s . c o m public SshToolsConnectionHostTab() { super(); // Create the main connection details panel JPanel mainConnectionDetailsPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(0, 2, 2, 2); gbc.weightx = 1.0; // Host name UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Hostname"), gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.HORIZONTAL; UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextHostname, gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.NONE; // Port UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Port"), gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextPort, gbc, GridBagConstraints.REMAINDER); // Username UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Username"), gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weighty = 1.0; UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextUsername, gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.NONE; // IconWrapperPanel iconMainConnectionDetailsPanel = new IconWrapperPanel( new ResourceIcon(SshToolsConnectionHostTab.class, CONNECT_ICON), mainConnectionDetailsPanel); // Authentication methods panel JPanel authMethodsPanel = new JPanel(new GridBagLayout()); authMethodsPanel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; GridBagConstraints gbc2 = new GridBagConstraints(); gbc2.fill = GridBagConstraints.HORIZONTAL; gbc2.anchor = GridBagConstraints.NORTHWEST; gbc2.insets = new Insets(2, 2, 2, 2); gbc2.weightx = 1.0; gbc2.weighty = 0.0; gbc2.gridx = 0; gbc2.gridy = 1; gbc2.gridwidth = 2; GridBagConstraints gbc3 = new GridBagConstraints(); gbc3.fill = GridBagConstraints.HORIZONTAL; gbc3.anchor = GridBagConstraints.NORTHWEST; gbc3.insets = new Insets(2, 2, 2, 2); gbc3.weightx = 1.0; gbc3.weighty = 0.0; gbc3.gridx = 0; gbc3.gridy = 2; gbc3.gridwidth = 2; GridBagConstraints gbc4 = new GridBagConstraints(); gbc4.fill = GridBagConstraints.HORIZONTAL; gbc4.anchor = GridBagConstraints.NORTHWEST; gbc4.insets = new Insets(26, 2, 2, 2); gbc4.weightx = 0.0; gbc4.weighty = 0.0; gbc4.gridx = 0; gbc4.gridy = 3; gbc4.gridwidth = 1; GridBagConstraints gbc5 = new GridBagConstraints(); gbc5.fill = GridBagConstraints.NONE; gbc5.anchor = GridBagConstraints.WEST; gbc5.insets = new Insets(26, 2, 2, 2); gbc5.weightx = 1.0; gbc5.weighty = 0.0; gbc5.gridx = 1; gbc5.gridy = 3; gbc5.gridwidth = 1; GridBagConstraints gbc6 = new GridBagConstraints(); gbc6.fill = GridBagConstraints.HORIZONTAL; gbc6.anchor = GridBagConstraints.NORTHWEST; gbc6.insets = new Insets(12, 2, 2, 2); gbc6.weightx = 0.0; gbc6.weighty = 0.0; gbc6.gridx = 0; gbc6.gridy = 4; gbc6.gridwidth = 1; GridBagConstraints gbc7 = new GridBagConstraints(); gbc7.fill = GridBagConstraints.NONE; gbc7.anchor = GridBagConstraints.WEST; gbc7.insets = new Insets(12, 2, 2, 2); gbc7.weightx = 1.0; gbc7.weighty = 0.0; gbc7.gridx = 1; gbc7.gridy = 4; gbc7.gridwidth = 1; GridBagConstraints gbc8 = new GridBagConstraints(); gbc8.fill = GridBagConstraints.HORIZONTAL; gbc8.anchor = GridBagConstraints.NORTHWEST; gbc8.insets = new Insets(12, 2, 2, 2); gbc8.weightx = 0.0; gbc8.weighty = 0.0; gbc8.gridx = 0; gbc8.gridy = 5; gbc8.gridwidth = 1; GridBagConstraints gbc9 = new GridBagConstraints(); gbc9.fill = GridBagConstraints.NONE; gbc9.anchor = GridBagConstraints.WEST; gbc9.insets = new Insets(12, 2, 2, 2); gbc9.weightx = 1.0; gbc9.weighty = 0.0; gbc9.gridx = 1; gbc9.gridy = 5; gbc9.gridwidth = 1; GridBagConstraints gbc10 = new GridBagConstraints(); gbc10.fill = GridBagConstraints.HORIZONTAL; gbc10.anchor = GridBagConstraints.NORTHWEST; gbc10.insets = new Insets(26, 2, 2, 2); gbc10.weightx = 1.0; gbc10.weighty = 0.0; gbc10.gridx = 0; gbc10.gridy = 6; gbc10.gridwidth = 2; // Authentication methods authMethodsPanel.add(new JLabel("Authentication Methods"), gbc); jListAuths.setVisibleRowCount(5); authMethodsPanel.add(new JScrollPane(jListAuths), gbc2); allowAgentForwarding = new JCheckBox("Allow agent forwarding"); authMethodsPanel.add(allowAgentForwarding, gbc3); String options[] = { "Full", "Limited", "None" }; delegationOption = new JComboBox(options); delegationOption.setSelectedIndex(0); authMethodsPanel.add(new JLabel("Delegation Type:"), gbc4); authMethodsPanel.add(delegationOption, gbc5); String optionsP[] = { "Pre-RFC Impersonation", "RFC Impersonation", "Legacy" }; proxyOption = new JComboBox(optionsP); proxyOption.setSelectedIndex(0); authMethodsPanel.add(new JLabel("Proxy Type:"), gbc6); authMethodsPanel.add(proxyOption, gbc7); authMethodsPanel.add(new JLabel("Proxy Lifetime (hours):"), gbc8); proxyLength.setColumns(5); authMethodsPanel.add(proxyLength, gbc9); gbc.gridx = 0; proxySave = new JCheckBox("Save Grid Proxies to Disk"); authMethodsPanel.add(proxySave, gbc10); // IconWrapperPanel iconAuthMethodsPanel = new IconWrapperPanel( new ResourceIcon(SshToolsConnectionHostTab.class, AUTH_ICON), authMethodsPanel); // This panel JPanel mine = new JPanel(); mine.setLayout(new GridBagLayout()); mine.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 0; mine.add(iconMainConnectionDetailsPanel, gbc); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 1; gbc.insets = new Insets(20, 2, 2, 2); mine.add(iconAuthMethodsPanel, gbc); setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.add(mine, BorderLayout.NORTH); // Set up the values in the various components addAuthenticationMethods(); }
From source file:org.parosproxy.paros.extension.history.ManualRequestEditorDialog.java
private JPanel getPanelCommand() { if (panelCommand == null) { jLabel = new JLabel(); jLabel.setText(""); panelCommand = new JPanel(); panelCommand.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints2.gridx = 0;//from w w w . j a v a 2s . c o m gridBagConstraints2.gridy = 0; gridBagConstraints2.ipadx = 0; gridBagConstraints2.ipady = 0; gridBagConstraints2.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints2.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints2.weightx = 1.0D; gridBagConstraints3.gridx = 3; gridBagConstraints3.gridy = 0; gridBagConstraints3.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints3.insets = new Insets(2, 2, 2, 2); gridBagConstraints1.gridx = 2; gridBagConstraints1.gridy = 0; gridBagConstraints11.anchor = GridBagConstraints.EAST; gridBagConstraints11.gridx = 1; gridBagConstraints11.gridy = 0; gridBagConstraints11.insets = new Insets(0, 0, 0, 0); panelCommand.add(jLabel, gridBagConstraints2); panelCommand.add(getChkUseTrackingSessionState(), gridBagConstraints11); panelCommand.add(getChkFollowRedirect(), gridBagConstraints1); panelCommand.add(getBtnSend(), gridBagConstraints3); } return panelCommand; }
From source file:org.rdv.ui.RBNBConnectionDialog.java
public RBNBConnectionDialog(JFrame owner, RBNBController rbnbController, DataPanelManager dataPanelManager) { super(owner, true); this.rbnb = rbnbController; this.dataPanelManager = dataPanelManager; setDefaultCloseOperation(DISPOSE_ON_CLOSE); setTitle("Connect to RBNB Server"); JPanel container = new JPanel(); setContentPane(container);// www . j a v a2 s .c om InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = container.getActionMap(); container.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weighty = 1; c.gridwidth = 1; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; headerLabel = new JLabel("Please specify the RBNB server connection information."); headerLabel.setBackground(Color.white); headerLabel.setOpaque(true); headerLabel.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray), BorderFactory.createEmptyBorder(10, 10, 10, 10))); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new Insets(0, 0, 0, 0); container.add(headerLabel, c); c.gridwidth = 1; rbnbHostNameLabel = new JLabel("Host:"); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 1; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new Insets(10, 10, 10, 5); container.add(rbnbHostNameLabel, c); rbnbHostNameTextField = new JTextField(25); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 1; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(10, 0, 10, 10); container.add(rbnbHostNameTextField, c); rbnbPortLabel = new JLabel("Port:"); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new Insets(0, 10, 10, 5); container.add(rbnbPortLabel, c); rbnbPortTextField = new JTextField(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 2; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(0, 0, 10, 10); rbnbPortTextField.addFocusListener(new FocusListener() { public void focusGained(FocusEvent focusEvent) { rbnbPortTextField.setSelectionStart(0); rbnbPortTextField.setSelectionEnd(rbnbPortTextField.getText().length()); } public void focusLost(FocusEvent focusEvent) { } }); container.add(rbnbPortTextField, c); JPanel buttonPanel = new JPanel(); Action connectAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = 5814028508027064335L; public void actionPerformed(ActionEvent e) { connect(); } }; connectAction.putValue(Action.NAME, "Connect"); inputMap.put(KeyStroke.getKeyStroke("ENTER"), "connect"); actionMap.put("connect", connectAction); connectButton = new JButton(connectAction); buttonPanel.add(connectButton); Action cancelAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = -679192362775669088L; public void actionPerformed(ActionEvent e) { cancel(); } }; cancelAction.putValue(Action.NAME, "Cancel"); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); actionMap.put("cancel", cancelAction); cancelButton = new JButton(cancelAction); buttonPanel.add(cancelButton); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 3; c.gridwidth = 2; c.anchor = GridBagConstraints.LINE_END; c.insets = new Insets(0, 10, 10, 5); container.add(buttonPanel, c); pack(); setLocationByPlatform(true); setVisible(true); }
From source file:org.n52.oxf.ui.swing.ReducedChartDialog.java
/** * initializes (or updates) the OXFChartPanel. * /*from w ww . ja v a 2s . c o m*/ * @param parameters * @param selectedfeatures */ private void initOXFChartPanel(OXFFeatureCollection observations, ParameterContainer paramCon) { // String[] foiIdArray = (String[]) // paramCon.getParameterShellWithServiceSidedName("featureOfInterest").getSpecifiedValueArray(); OXFChartPanel chartPanel = new OXFChartPanel(); MyGridBagLayout mainLayout = (MyGridBagLayout) getContentPane().getLayout(); if (getContentPane().getComponentCount() > 2) { getContentPane().remove(2); } mainLayout.addComponent(0, chartPanel, 0, 0, 1, 1, 100, 100, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(9, 9, 9, 9)); // TODO what's about AnimatedVisualization ?? StaticVisualization visualization = (StaticVisualization) chartRenderer.renderChart(observations, paramCon, chartWidth, chartHeight); chartPanel.setChartImage(visualization.getRendering()); getContentPane().validate(); }
From source file:com.smart.aqimonitor.client.AqiSettingDialog.java
/** * Create the dialog.// ww w. ja v a 2s . c om */ public AqiSettingDialog(Frame owner, final AbstractAqiParser aqiParser) { super(owner); this.aqiParser = aqiParser; setTitle("\u8BBE\u7F6E"); setResizable(false); setBounds(100, 100, 450, 135); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); GridBagLayout gbl_contentPanel = new GridBagLayout(); gbl_contentPanel.columnWidths = new int[] { 33, 48, 66, 41, 48, 66, 0, 0 }; gbl_contentPanel.rowHeights = new int[] { 21, 0, 0 }; gbl_contentPanel.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE }; gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE }; contentPanel.setLayout(gbl_contentPanel); { JLabel lblRetryTimes = new JLabel("\u91CD\u8BD5\u6B21\u6570\uFF1A"); GridBagConstraints gbc_lblRetryTimes = new GridBagConstraints(); gbc_lblRetryTimes.anchor = GridBagConstraints.WEST; gbc_lblRetryTimes.insets = new Insets(0, 0, 5, 5); gbc_lblRetryTimes.gridx = 1; gbc_lblRetryTimes.gridy = 0; contentPanel.add(lblRetryTimes, gbc_lblRetryTimes); } { tfRetryTimes = new JTextField(); tfRetryTimes.setPreferredSize(new Dimension(6, 29)); tfRetryTimes.setMinimumSize(new Dimension(60, 29)); GridBagConstraints gbc_tfRetryTimes = new GridBagConstraints(); gbc_tfRetryTimes.anchor = GridBagConstraints.NORTHWEST; gbc_tfRetryTimes.insets = new Insets(0, 0, 5, 5); gbc_tfRetryTimes.gridx = 2; gbc_tfRetryTimes.gridy = 0; contentPanel.add(tfRetryTimes, gbc_tfRetryTimes); tfRetryTimes.setColumns(10); } { JLabel lblRetryGap = new JLabel("\u91CD\u8BD5\u95F4\u9694\uFF1A"); GridBagConstraints gbc_lblRetryGap = new GridBagConstraints(); gbc_lblRetryGap.anchor = GridBagConstraints.WEST; gbc_lblRetryGap.insets = new Insets(0, 0, 5, 5); gbc_lblRetryGap.gridx = 4; gbc_lblRetryGap.gridy = 0; contentPanel.add(lblRetryGap, gbc_lblRetryGap); } { tfRetryGap = new JTextField(); tfRetryGap.setMinimumSize(new Dimension(60, 29)); tfRetryGap.setPreferredSize(new Dimension(60, 29)); GridBagConstraints gbc_tfRetryGap = new GridBagConstraints(); gbc_tfRetryGap.insets = new Insets(0, 0, 5, 5); gbc_tfRetryGap.anchor = GridBagConstraints.NORTHWEST; gbc_tfRetryGap.gridx = 5; gbc_tfRetryGap.gridy = 0; contentPanel.add(tfRetryGap, gbc_tfRetryGap); tfRetryGap.setColumns(10); } { JLabel label = new JLabel("\u5206\u949F"); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.insets = new Insets(0, 0, 5, 0); gbc_label.gridx = 6; gbc_label.gridy = 0; contentPanel.add(label, gbc_label); } { JLabel lblExportPath = new JLabel("\u8F93\u51FA\u8DEF\u5F84\uFF1A"); GridBagConstraints gbc_lblExportPath = new GridBagConstraints(); gbc_lblExportPath.anchor = GridBagConstraints.EAST; gbc_lblExportPath.insets = new Insets(0, 0, 0, 5); gbc_lblExportPath.gridx = 1; gbc_lblExportPath.gridy = 1; contentPanel.add(lblExportPath, gbc_lblExportPath); } { tfExportPath = new JTextField(); tfExportPath.setEditable(false); tfExportPath.setPreferredSize(new Dimension(180, 29)); tfExportPath.setMinimumSize(new Dimension(180, 29)); GridBagConstraints gbc_tfExportPath = new GridBagConstraints(); gbc_tfExportPath.gridwidth = 4; gbc_tfExportPath.insets = new Insets(0, 0, 0, 5); gbc_tfExportPath.fill = GridBagConstraints.HORIZONTAL; gbc_tfExportPath.gridx = 2; gbc_tfExportPath.gridy = 1; contentPanel.add(tfExportPath, gbc_tfExportPath); tfExportPath.setColumns(10); } { JButton button = new JButton("..."); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { fDialog = new JFileChooser(); // fDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int result = fDialog.showOpenDialog(contentPanel); if (result == JFileChooser.APPROVE_OPTION) { tfExportPath.setText(fDialog.getSelectedFile().getAbsolutePath()); } } }); GridBagConstraints gbc_button = new GridBagConstraints(); gbc_button.gridx = 6; gbc_button.gridy = 1; contentPanel.add(button, gbc_button); } { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("\u786E\u5B9A"); okButton.setName("settingOk"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String retryTimes = tfRetryTimes.getText(); if (StringUtils.isEmpty(retryTimes) || !isNumeric(retryTimes)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } String retryGap = tfRetryGap.getText(); if (StringUtils.isEmpty(retryGap) || !isNumeric(retryGap)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } String exportPath = tfExportPath.getText(); if (StringUtils.isEmpty(exportPath)) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } File testFile = new File(exportPath); if (!testFile.exists()) { JOptionPane.showMessageDialog(contentPanel, "", "", JOptionPane.ERROR_MESSAGE); return; } props.put("query.retryTimes", retryTimes); props.put("query.retryGap", retryGap); props.put("result.path", exportPath); try { props.store(new FileOutputStream(propertiesResource.getFile()), ""); aqiParser.setRetryTimes(Integer.parseInt(retryTimes)); aqiParser.setRetryGap(Integer.parseInt(retryGap)); aqiParser.setFilePath(exportPath); } catch (IOException e1) { e1.printStackTrace(); } finally { dispose(); } } }); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton("\u53D6\u6D88"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } }
From source file:org.rdv.ui.LoginDialog.java
public LoginDialog(JFrame owner) { super(owner, true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setTitle("Login to NEES"); JPanel container = new JPanel(); setContentPane(container);/*from w w w.j a v a2 s . com*/ InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = container.getActionMap(); container.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.weighty = 1; c.gridwidth = 1; c.gridheight = 1; c.ipadx = 0; c.ipady = 0; headerLabel = new JLabel("Please specify your NEES account information."); headerLabel.setBackground(Color.white); headerLabel.setOpaque(true); headerLabel.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray), BorderFactory.createEmptyBorder(10, 10, 10, 10))); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 0; c.gridwidth = 2; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new Insets(0, 0, 0, 0); container.add(headerLabel, c); errorLabel = new JLabel(); errorLabel.setVisible(false); errorLabel.setForeground(Color.RED); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0; c.gridx = 0; c.gridy = 1; c.insets = new Insets(10, 10, 0, 10); container.add(errorLabel, c); c.gridwidth = 1; userNameLabel = new JLabel("Username:"); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new Insets(10, 10, 10, 5); container.add(userNameLabel, c); userNameTextField = new JTextField("", 25); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 2; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(10, 0, 10, 10); container.add(userNameTextField, c); userPasswordLabel = new JLabel("Password:"); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 3; c.anchor = GridBagConstraints.NORTHEAST; c.insets = new Insets(0, 10, 10, 5); container.add(userPasswordLabel, c); userPasswordField = new JPasswordField(16); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1; c.gridx = 1; c.gridy = 3; c.anchor = GridBagConstraints.NORTHWEST; c.insets = new Insets(0, 0, 10, 10); container.add(userPasswordField, c); JPanel buttonPanel = new JPanel(); Action loginAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = -5591044023056646223L; public void actionPerformed(ActionEvent e) { login(); } }; loginAction.putValue(Action.NAME, "Login"); inputMap.put(KeyStroke.getKeyStroke("ENTER"), "login"); actionMap.put("login", loginAction); loginButton = new JButton(loginAction); buttonPanel.add(loginButton); Action cancelAction = new AbstractAction() { /** serialization version identifier */ private static final long serialVersionUID = 6237115705468556255L; public void actionPerformed(ActionEvent e) { cancel(); } }; cancelAction.putValue(Action.NAME, "Cancel"); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel"); actionMap.put("cancel", cancelAction); cancelButton = new JButton(cancelAction); buttonPanel.add(cancelButton); c.fill = GridBagConstraints.NONE; c.weightx = 0; c.gridx = 0; c.gridy = 4; c.gridwidth = 2; c.anchor = GridBagConstraints.LINE_END; c.insets = new Insets(0, 10, 10, 5); container.add(buttonPanel, c); pack(); setLocationByPlatform(true); setVisible(true); }
From source file:org.zaproxy.zap.extension.portscan.PortScanPanel.java
/** /*w ww .java2s .c o m*/ * This method initializes panelCommand * * @return javax.swing.JPanel */ /**/ private javax.swing.JPanel getPanelCommand() { if (panelCommand == null) { panelCommand = new javax.swing.JPanel(); panelCommand.setLayout(new java.awt.GridBagLayout()); panelCommand.setName("PortScan"); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.gridy = 0; gridBagConstraints1.insets = new java.awt.Insets(2, 2, 2, 2); gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.weightx = 1.0D; gridBagConstraints2.gridx = 0; gridBagConstraints2.gridy = 1; gridBagConstraints2.weightx = 1.0; gridBagConstraints2.weighty = 1.0; gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints2.insets = new java.awt.Insets(0, 0, 0, 0); gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST; panelCommand.add(this.getPanelToolbar(), gridBagConstraints1); panelCommand.add(getJScrollPane(), gridBagConstraints2); } return panelCommand; }
From source file:org.n52.ifgicopter.spf.gui.FrameworkCorePanel.java
/** * default constructor to create the framework core panel. *//*from w ww . j av a2s.co m*/ public FrameworkCorePanel() { /* * INPUT PLUGIN LIST */ this.pluginsPanel = new JPanel(); this.pluginsPanel.setLayout(new GridBagLayout()); this.pluginsPanel.setBackground(DEFAULT_COLOR); this.globalGBC = new GridBagConstraints(); this.globalGBC.gridx = 0; this.globalGBC.gridy = 0; this.globalGBC.weightx = 0.0; this.globalGBC.weighty = 0.0; this.globalGBC.anchor = GridBagConstraints.NORTHWEST; this.globalGBC.fill = GridBagConstraints.HORIZONTAL; this.pluginsPanel.add( new JLabel("<html><body><div><strong>" + "Active Plugins</strong></div></body></html>"), this.globalGBC); this.globalGBC.gridy++; this.globalGBC.gridwidth = GridBagConstraints.REMAINDER; this.globalGBC.insets = new Insets(0, 0, 5, 0); this.pluginsPanel.add(new JSeparator(), this.globalGBC); this.globalGBC.insets = new Insets(0, 0, 0, 0); this.globalGBC.weightx = 1.0; this.globalGBC.gridy = 0; this.globalGBC.gridx = 1; this.pluginsPanel.add(Box.createHorizontalGlue(), this.globalGBC); this.globalGBC.weightx = 0.0; this.globalGBC.gridx = 0; this.globalGBC.gridy = 1; /* * the contentpanel */ this.contentPanel = new JPanel(); this.contentPanel.setLayout(new CardLayout()); this.contentPanel.setBorder(BorderFactory.createEtchedBorder()); this.contentPanel.add(WelcomePanel.getInstance(), WELCOME_PANEL); // ((CardLayout) contentPanel.getLayout()).show(contentPanel, WELCOME_PANEL); JScrollPane startupS = new JScrollPane(this.contentPanel); startupS.setViewportBorder(null); /* * wrap the plugins to ensure top alignment */ JPanel pluginsPanelWrapper = new JPanel(new BorderLayout()); pluginsPanelWrapper.add(this.pluginsPanel, BorderLayout.NORTH); pluginsPanelWrapper.add(Box.createVerticalGlue(), BorderLayout.CENTER); pluginsPanelWrapper.setBorder(BorderFactory.createEtchedBorder()); pluginsPanelWrapper.setBackground(this.pluginsPanel.getBackground()); JScrollPane wrapperS = new JScrollPane(pluginsPanelWrapper); wrapperS.setViewportBorder(null); /* * add both scroll panes to the split pane */ JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, wrapperS, startupS); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(250); splitPane.setContinuousLayout(true); Dimension minimumSize = new Dimension(100, 100); startupS.setMinimumSize(minimumSize); this.setLayout(new BorderLayout()); this.add(splitPane); }
From source file:com.limegroup.gnutella.gui.LicenseWindow.java
protected void createNotVerified() { GridBagConstraints c = new GridBagConstraints(); JTextArea text = newTextArea(getNotVerifiedString()); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; c.weightx = 1;//from ww w . j ava 2 s . c o m c.weighty = 1; c.anchor = GridBagConstraints.NORTHWEST; DETAILS.add(text, c); JButton button = new JButton(getVerifyString()); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { LICENSE.verify(LicenseWindow.this); buildDetails(); } }); c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.NONE; c.weightx = 0; c.weighty = 0; c.anchor = GridBagConstraints.SOUTHWEST; DETAILS.add(button, c); }
From source file:org.openconcerto.erp.core.finance.accounting.element.AnalytiqueSQLElement.java
public SQLComponent createComponent() { return new BaseSQLComponent(this) { public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); c.anchor = GridBagConstraints.NORTHWEST; c.gridwidth = 4;//w ww.java2s . co m c.gridheight = 8; vecteurTabAxe = new Vector(); repartitionsAxe = new Vector(); repartitionElemsAxe = new Vector(); postesAxe = new Vector(); tabAxes = new JTabbedPane(); /*********************************************************************************** * * CREATION DES ONGLETS **********************************************************************************/ // on recupere les axes existant // SELECT ID, NOM FROM AXE SQLBase base = getTable().getBase(); SQLSelect sel = new SQLSelect(base); sel.addSelect(getTable().getKey()); sel.addSelect(getTable().getField("NOM")); sel.addRawOrder("AXE_ANALYTIQUE.NOM"); String req = sel.asString(); Object ob = getTable().getBase().getDataSource().execute(req, new ArrayListHandler()); List myList = (List) ob; if (myList.size() != 0) { // on cre les onglets et on stocke les axes for (int i = 0; i < myList.size(); i++) { // ID, nom Object[] objTmp = (Object[]) myList.get(i); axes.add(new Axe(Integer.parseInt(objTmp[0].toString()), objTmp[1].toString())); // on recupere les repartitions et les lements associs l'axe RepartitionAxeAnalytiquePanel repAxeComp = new RepartitionAxeAnalytiquePanel( ((Axe) axes.get(i)).getId()); repartitionsAxe.add(repAxeComp.getRepartitions()); repartitionElemsAxe.add(repAxeComp.getRepartitionElems()); postesAxe.add(repAxeComp.getPostes()); tabAxes.addTab(((Axe) axes.get(i)).getNom(), repAxeComp); vecteurTabAxe.add(i, new String(String.valueOf(i))); } System.out.println("Size ----> " + axes.size()); } else { ajouterAxe("Nouvel Axe"); } c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; this.add(tabAxes, c); tabAxes.addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent e) { final int index = tabAxes.indexAtLocation(e.getX(), e.getY()); validAxeText(); if (e.getClickCount() == 2) { actionModifierAxe(e, index); } if (e.getButton() == MouseEvent.BUTTON3) { actionDroitOnglet(index, e); } } }); tabAxes.addAncestorListener(new AncestorListener() { public void ancestorAdded(AncestorEvent event) { validAxeText(); } public void ancestorRemoved(AncestorEvent event) { validAxeText(); } public void ancestorMoved(AncestorEvent event) { validAxeText(); } }); /*********************************************************************************** * * AJOUT D'UN AXE **********************************************************************************/ JButton boutonAddAxe = new JButton("Ajouter un axe"); boutonAddAxe.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (ajoutAxeFrame == null) { ajoutAxeFrame = new AjouterAxeAnalytiqueFrame(a); } ajoutAxeFrame.pack(); ajoutAxeFrame.setVisible(true); } }); c.gridx += 4; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; this.add(boutonAddAxe, c); /*********************************************************************************** * * SUPPRESSION D'UN AXE **********************************************************************************/ JButton boutonDelAxe = new JButton("Supprimer un axe"); boutonDelAxe.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { supprimerAxe(Integer.parseInt(vecteurTabAxe.get(tabAxes.getSelectedIndex()).toString())); } }); c.gridy++; this.add(boutonDelAxe, c); JButton boutonSet = new JButton("SetVal"); boutonSet.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVal(); } }); c.gridy++; this.add(boutonSet, c); JButton boutonCheck = new JButton("Check"); boutonCheck.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { checkID(); } }); c.gridy++; this.add(boutonCheck, c); } }; }