List of usage examples for java.awt GridBagConstraints WEST
int WEST
To view the source code for java.awt GridBagConstraints WEST.
Click Source Link
From source file:FontChooser.java
/** This method is called from within the constructor to * initialize the form./*from w ww. j av a 2 s .c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents() { jPanel3 = new javax.swing.JPanel(); jFont = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); jFontList = new javax.swing.JList(); jPanel4 = new javax.swing.JPanel(); jStyle = new javax.swing.JTextField(); jScrollPane2 = new javax.swing.JScrollPane(); jStyleList = new javax.swing.JList(); jPanel5 = new javax.swing.JPanel(); jSize = new javax.swing.JTextField(); jScrollPane3 = new javax.swing.JScrollPane(); jSizeList = new javax.swing.JList(); jPanel1 = new javax.swing.JPanel(); jScrollPane4 = new javax.swing.JScrollPane(); jSample = new javax.swing.JTextArea(); jButtons = new javax.swing.JPanel(); jOk = new javax.swing.JButton(); jCancel = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); getContentPane().setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints1; setTitle("Font Chooser"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jPanel3.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints2; jPanel3.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " Font ")); jFont.setColumns(24); jFont.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jFontActionPerformed(evt); } }); gridBagConstraints2 = new java.awt.GridBagConstraints(); gridBagConstraints2.gridwidth = 0; gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints2.insets = new java.awt.Insets(0, 3, 0, 3); gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints2.weightx = 1.0; jPanel3.add(jFont, gridBagConstraints2); jFontList.setModel(new DefaultListModel()); jFontList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jFontList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { jFontListValueChanged(evt); } }); jScrollPane1.setViewportView(jFontList); gridBagConstraints2 = new java.awt.GridBagConstraints(); gridBagConstraints2.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints2.insets = new java.awt.Insets(3, 3, 3, 3); gridBagConstraints2.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints2.weightx = 1.0; gridBagConstraints2.weighty = 1.0; jPanel3.add(jScrollPane1, gridBagConstraints2); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 0); gridBagConstraints1.weightx = 0.5; gridBagConstraints1.weighty = 1.0; getContentPane().add(jPanel3, gridBagConstraints1); jPanel4.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints3; jPanel4.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " Style ")); jStyle.setColumns(18); jStyle.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jStyleActionPerformed(evt); } }); gridBagConstraints3 = new java.awt.GridBagConstraints(); gridBagConstraints3.gridwidth = 0; gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints3.insets = new java.awt.Insets(0, 3, 0, 3); gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints3.weightx = 1.0; jPanel4.add(jStyle, gridBagConstraints3); jStyleList.setModel(new DefaultListModel()); jStyleList.setVisibleRowCount(4); jStyleList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { jStyleListValueChanged(evt); } }); jScrollPane2.setViewportView(jStyleList); gridBagConstraints3 = new java.awt.GridBagConstraints(); gridBagConstraints3.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints3.insets = new java.awt.Insets(3, 3, 3, 3); gridBagConstraints3.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints3.weightx = 0.5; gridBagConstraints3.weighty = 1.0; jPanel4.add(jScrollPane2, gridBagConstraints3); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 0); gridBagConstraints1.weightx = 0.375; gridBagConstraints1.weighty = 1.0; getContentPane().add(jPanel4, gridBagConstraints1); jPanel5.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints4; jPanel5.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " Size ")); jSize.setColumns(6); jSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jSizeActionPerformed(evt); } }); gridBagConstraints4 = new java.awt.GridBagConstraints(); gridBagConstraints4.gridwidth = 0; gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints4.insets = new java.awt.Insets(0, 3, 0, 3); gridBagConstraints4.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints4.weightx = 1.0; jPanel5.add(jSize, gridBagConstraints4); jSizeList.setModel(new DefaultListModel()); jSizeList.setVisibleRowCount(4); jSizeList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); jSizeList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { jSizeListValueChanged(evt); } }); jScrollPane3.setViewportView(jSizeList); gridBagConstraints4 = new java.awt.GridBagConstraints(); gridBagConstraints4.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints4.insets = new java.awt.Insets(3, 3, 3, 3); gridBagConstraints4.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints4.weightx = 0.25; gridBagConstraints4.weighty = 1.0; jPanel5.add(jScrollPane3, gridBagConstraints4); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets(5, 5, 0, 5); gridBagConstraints1.weightx = 0.125; gridBagConstraints1.weighty = 1.0; getContentPane().add(jPanel5, gridBagConstraints1); jPanel1.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints5; jPanel1.setBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EtchedBorder(), " Sample ")); jSample.setWrapStyleWord(true); jSample.setLineWrap(true); jSample.setColumns(20); jSample.setRows(3); jSample.setText("The quick brown fox jumped over the lazy dog."); jScrollPane4.setViewportView(jSample); gridBagConstraints5 = new java.awt.GridBagConstraints(); gridBagConstraints5.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints5.insets = new java.awt.Insets(0, 3, 3, 3); gridBagConstraints5.weightx = 1.0; gridBagConstraints5.weighty = 1.0; jPanel1.add(jScrollPane4, gridBagConstraints5); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets(0, 5, 0, 5); gridBagConstraints1.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints1.weightx = 1.0; getContentPane().add(jPanel1, gridBagConstraints1); jButtons.setLayout(new java.awt.GridBagLayout()); java.awt.GridBagConstraints gridBagConstraints6; jOk.setMnemonic(KeyEvent.VK_O); jOk.setText("OK"); jOk.setRequestFocusEnabled(false); jOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jOkActionPerformed(evt); } }); gridBagConstraints6 = new java.awt.GridBagConstraints(); gridBagConstraints6.insets = new java.awt.Insets(5, 5, 5, 0); gridBagConstraints6.anchor = java.awt.GridBagConstraints.WEST; jButtons.add(jOk, gridBagConstraints6); jCancel.setMnemonic(KeyEvent.VK_C); jCancel.setText("Cancel"); jCancel.setRequestFocusEnabled(false); jCancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCancelActionPerformed(evt); } }); gridBagConstraints6 = new java.awt.GridBagConstraints(); gridBagConstraints6.gridwidth = 0; gridBagConstraints6.insets = new java.awt.Insets(5, 5, 5, 5); gridBagConstraints6.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints6.weightx = 1.0; jButtons.add(jCancel, gridBagConstraints6); gridBagConstraints6 = new java.awt.GridBagConstraints(); gridBagConstraints6.weightx = 1.0; jButtons.add(jLabel6, gridBagConstraints6); gridBagConstraints1 = new java.awt.GridBagConstraints(); gridBagConstraints1.gridwidth = 0; gridBagConstraints1.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints1.weightx = 1.0; getContentPane().add(jButtons, gridBagConstraints1); }
From source file:com.litt.core.security.license.gui.ConfigPanel.java
/** * Create the panel.//from www . ja v a2 s . c o m */ public ConfigPanel(final Gui gui) { GridBagLayout gbl_configPanel = new GridBagLayout(); gbl_configPanel.columnWidths = new int[] { 0, 0, 0, 0 }; gbl_configPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_configPanel.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE }; gbl_configPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE }; this.setLayout(gbl_configPanel); JLabel label_18 = new JLabel("?"); GridBagConstraints gbc_label_18 = new GridBagConstraints(); gbc_label_18.insets = new Insets(0, 0, 5, 5); gbc_label_18.anchor = GridBagConstraints.EAST; gbc_label_18.gridx = 0; gbc_label_18.gridy = 0; this.add(label_18, gbc_label_18); comboBox_config = new JComboBox(); comboBox_config.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { try { LicenseConfig licenseConfig = (LicenseConfig) e.getItem(); File licenseFile = new File(licenseConfig.getLicenseFilePath()); currentLicenseConfig = licenseConfig; loadLicense(licenseFile); gui.setCurrentLicenseConfig(currentLicenseConfig); } catch (Exception e1) { JOptionPane.showMessageDialog(self, e1.getMessage()); } } } }); GridBagConstraints gbc_comboBox_config = new GridBagConstraints(); gbc_comboBox_config.insets = new Insets(0, 0, 5, 5); gbc_comboBox_config.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox_config.gridx = 1; gbc_comboBox_config.gridy = 0; this.add(comboBox_config, gbc_comboBox_config); JButton button_3 = new JButton("?"); button_3.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { try { comboBox_config.removeAllItems(); File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml"); Document document = XmlUtils.readXml(configFile); Element rootE = document.getRootElement(); List productList = rootE.elements(); for (int i = 0; i < productList.size(); i++) { Element productE = (Element) productList.get(i); String productCode = productE.attributeValue("code"); List customerList = productE.elements(); for (int j = 0; j < customerList.size(); j++) { Element customerE = (Element) customerList.get(j); String customerCode = customerE.attributeValue("code"); LicenseConfig licenseConfig = new LicenseConfig(); licenseConfig.setProductCode(productCode); licenseConfig.setCustomerCode(customerCode); licenseConfig.setLicenseId(customerE.elementText("licenseId")); licenseConfig.setEncryptedLicense(customerE.elementText("encryptedLicense")); licenseConfig.setRootFilePath(Gui.HOME_PATH); licenseConfig.setLicenseFilePath(Gui.HOME_PATH + File.separator + productCode + File.separator + customerCode + File.separator + "license.xml"); licenseConfig.setPriKeyFilePath( Gui.HOME_PATH + File.separator + productCode + File.separator + "private.key"); licenseConfig.setPubKeyFilePath( Gui.HOME_PATH + File.separator + productCode + File.separator + "license.key"); comboBox_config.addItem(licenseConfig); if (i == 0 && j == 0) { File licenseFile = new File(licenseConfig.getLicenseFilePath()); currentLicenseConfig = licenseConfig; loadLicense(licenseFile); gui.setCurrentLicenseConfig(currentLicenseConfig); btnDelete.setEnabled(true); } } } } catch (Exception e1) { e1.printStackTrace(); JOptionPane.showMessageDialog(self, e1.getMessage()); } } }); btnDelete = new JButton(); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (currentLicenseConfig != null) { try { String productCode = currentLicenseConfig.getProductCode(); String customerCode = currentLicenseConfig.getCustomerCode(); //congfig.xml File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml"); Document document = XmlUtils.readXml(configFile); Element customerNode = (Element) document.selectSingleNode( "//product[@code='" + productCode + "']/customer[@code='" + customerCode + "']"); if (customerNode != null) { customerNode.detach(); XmlUtils.writeXml(configFile, document); } // File licensePathFile = new File(currentLicenseConfig.getLicenseFilePath()); if (licensePathFile.exists()) { FileUtils.deleteDirectory(licensePathFile.getParentFile()); } //comboboxitem comboBox_config.removeItemAt(comboBox_config.getSelectedIndex()); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if (comboBox_config.getItemCount() <= 0) { btnDelete.setEnabled(false); } } } }); btnDelete.setEnabled(false); btnDelete.setIcon(new ImageIcon(ConfigPanel.class.getResource("/images/icon_delete.png"))); GridBagConstraints gbc_btnDelete = new GridBagConstraints(); gbc_btnDelete.insets = new Insets(0, 0, 5, 0); gbc_btnDelete.gridx = 2; gbc_btnDelete.gridy = 0; add(btnDelete, gbc_btnDelete); GridBagConstraints gbc_button_3 = new GridBagConstraints(); gbc_button_3.insets = new Insets(0, 0, 5, 5); gbc_button_3.gridx = 1; gbc_button_3.gridy = 1; this.add(button_3, gbc_button_3); JLabel lblid = new JLabel("?ID"); GridBagConstraints gbc_lblid = new GridBagConstraints(); gbc_lblid.anchor = GridBagConstraints.EAST; gbc_lblid.insets = new Insets(0, 0, 5, 5); gbc_lblid.gridx = 0; gbc_lblid.gridy = 2; this.add(lblid, gbc_lblid); textField_licenseId = new JTextField(); GridBagConstraints gbc_textField_licenseId = new GridBagConstraints(); gbc_textField_licenseId.insets = new Insets(0, 0, 5, 5); gbc_textField_licenseId.fill = GridBagConstraints.HORIZONTAL; gbc_textField_licenseId.gridx = 1; gbc_textField_licenseId.gridy = 2; this.add(textField_licenseId, gbc_textField_licenseId); textField_licenseId.setColumns(10); JLabel label = new JLabel("?"); GridBagConstraints gbc_label = new GridBagConstraints(); gbc_label.anchor = GridBagConstraints.EAST; gbc_label.insets = new Insets(0, 0, 5, 5); gbc_label.gridx = 0; gbc_label.gridy = 3; add(label, gbc_label); comboBox_licenseType = new JComboBox(MapComboBoxModel.getLicenseTypeOptions().toArray()); GridBagConstraints gbc_comboBox_licenseType = new GridBagConstraints(); gbc_comboBox_licenseType.insets = new Insets(0, 0, 5, 5); gbc_comboBox_licenseType.fill = GridBagConstraints.HORIZONTAL; gbc_comboBox_licenseType.gridx = 1; gbc_comboBox_licenseType.gridy = 3; add(comboBox_licenseType, gbc_comboBox_licenseType); JLabel label_23 = new JLabel("???"); GridBagConstraints gbc_label_23 = new GridBagConstraints(); gbc_label_23.anchor = GridBagConstraints.EAST; gbc_label_23.insets = new Insets(0, 0, 5, 5); gbc_label_23.gridx = 0; gbc_label_23.gridy = 4; this.add(label_23, gbc_label_23); textField_productName = new JTextField(); GridBagConstraints gbc_textField_productName = new GridBagConstraints(); gbc_textField_productName.insets = new Insets(0, 0, 5, 5); gbc_textField_productName.fill = GridBagConstraints.HORIZONTAL; gbc_textField_productName.gridx = 1; gbc_textField_productName.gridy = 4; this.add(textField_productName, gbc_textField_productName); textField_productName.setColumns(10); JLabel label_24 = new JLabel("???"); GridBagConstraints gbc_label_24 = new GridBagConstraints(); gbc_label_24.anchor = GridBagConstraints.EAST; gbc_label_24.insets = new Insets(0, 0, 5, 5); gbc_label_24.gridx = 0; gbc_label_24.gridy = 5; this.add(label_24, gbc_label_24); textField_companyName = new JTextField(); GridBagConstraints gbc_textField_companyName = new GridBagConstraints(); gbc_textField_companyName.insets = new Insets(0, 0, 5, 5); gbc_textField_companyName.fill = GridBagConstraints.HORIZONTAL; gbc_textField_companyName.gridx = 1; gbc_textField_companyName.gridy = 5; this.add(textField_companyName, gbc_textField_companyName); textField_companyName.setColumns(10); JLabel label_25 = new JLabel("??"); GridBagConstraints gbc_label_25 = new GridBagConstraints(); gbc_label_25.anchor = GridBagConstraints.EAST; gbc_label_25.insets = new Insets(0, 0, 5, 5); gbc_label_25.gridx = 0; gbc_label_25.gridy = 6; this.add(label_25, gbc_label_25); textField_customerName = new JTextField(); GridBagConstraints gbc_textField_customerName = new GridBagConstraints(); gbc_textField_customerName.insets = new Insets(0, 0, 5, 5); gbc_textField_customerName.fill = GridBagConstraints.HORIZONTAL; gbc_textField_customerName.gridx = 1; gbc_textField_customerName.gridy = 6; this.add(textField_customerName, gbc_textField_customerName); textField_customerName.setColumns(10); JLabel label_26 = new JLabel(""); GridBagConstraints gbc_label_26 = new GridBagConstraints(); gbc_label_26.anchor = GridBagConstraints.EAST; gbc_label_26.insets = new Insets(0, 0, 5, 5); gbc_label_26.gridx = 0; gbc_label_26.gridy = 7; this.add(label_26, gbc_label_26); textField_version = new JTextField(); GridBagConstraints gbc_textField_version = new GridBagConstraints(); gbc_textField_version.insets = new Insets(0, 0, 5, 5); gbc_textField_version.fill = GridBagConstraints.HORIZONTAL; gbc_textField_version.gridx = 1; gbc_textField_version.gridy = 7; this.add(textField_version, gbc_textField_version); textField_version.setColumns(10); JLabel label_27 = new JLabel(""); GridBagConstraints gbc_label_27 = new GridBagConstraints(); gbc_label_27.insets = new Insets(0, 0, 5, 5); gbc_label_27.gridx = 0; gbc_label_27.gridy = 8; this.add(label_27, gbc_label_27); datePicker_expiredDate = new DatePicker(new Date(), "yyyy-MM-dd", null, null); //datePicker_expiredDate.setTimePanleVisible(false); GridBagConstraints gbc_datePicker_expiredDate = new GridBagConstraints(); gbc_datePicker_expiredDate.anchor = GridBagConstraints.WEST; gbc_datePicker_expiredDate.insets = new Insets(0, 0, 5, 5); gbc_datePicker_expiredDate.gridx = 1; gbc_datePicker_expiredDate.gridy = 8; this.add(datePicker_expiredDate, gbc_datePicker_expiredDate); JButton button_5 = new JButton(""); button_5.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (currentLicenseConfig != null) { try { File priKeyFile = new File(currentLicenseConfig.getPriKeyFilePath()); File licenseFile = new File(currentLicenseConfig.getLicenseFilePath()); //?? License license = new License(); license.setLicenseId(textField_licenseId.getText()); license.setLicenseType( ((MapComboBoxModel) comboBox_licenseType.getSelectedItem()).getValue().toString()); license.setProductName(textField_productName.getText()); license.setCompanyName(textField_companyName.getText()); license.setCustomerName(textField_customerName.getText()); license.setVersion(Version.parseVersion(textField_version.getText())); license.setCreateDate(new Date()); license.setExpiredDate(Utility.parseDate(datePicker_expiredDate.getText())); //???? DigitalSignatureTool utils = new DigitalSignatureTool("DSA"); utils.readPriKey(priKeyFile.getAbsolutePath()); //?? String signedData = utils.sign(license.toString()); //?????? license.setSignature(signedData); LicenseManager.writeLicense(license, licenseFile); //config.xml String licenseContent = XmlUtils.readXml(licenseFile).asXML(); //DES ISecurity security = new DESTool(currentLicenseConfig.getLicenseId(), Algorithm.BLOWFISH); licenseContent = security.encrypt(licenseContent); txt_encryptContent.setText(licenseContent); currentLicenseConfig.setEncryptedLicense(licenseContent); System.out.println(licenseContent); File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml"); XMLConfiguration config = new XMLConfiguration(configFile); config.setAutoSave(true); config.setProperty("product.customer.encryptedLicense", licenseContent); //??zip? File customerPath = licenseFile.getParentFile(); //???license????? File licensePath = new File(customerPath.getParent(), "license"); if (!licensePath.exists() && !licensePath.isDirectory()) { licensePath.mkdir(); } else { FileUtils.cleanDirectory(licensePath); } //? FileUtils.copyDirectory(customerPath, licensePath); String currentTime = FormatDateTime.formatDateTimeNum(new Date()); ZipUtils.zip(licensePath, new File(licensePath.getParentFile(), currentLicenseConfig.getCustomerCode() + "-" + currentTime + ".zip")); //license FileUtils.deleteDirectory(licensePath); JOptionPane.showMessageDialog(self, "??"); } catch (Exception e1) { e1.printStackTrace(); JOptionPane.showMessageDialog(self, e1.getMessage()); } } else { JOptionPane.showMessageDialog(self, "???"); } } }); GridBagConstraints gbc_button_5 = new GridBagConstraints(); gbc_button_5.insets = new Insets(0, 0, 5, 5); gbc_button_5.gridx = 1; gbc_button_5.gridy = 9; this.add(button_5, gbc_button_5); JScrollPane scrollPane = new JScrollPane(); GridBagConstraints gbc_scrollPane = new GridBagConstraints(); gbc_scrollPane.insets = new Insets(0, 0, 0, 5); gbc_scrollPane.fill = GridBagConstraints.BOTH; gbc_scrollPane.gridx = 1; gbc_scrollPane.gridy = 10; this.add(scrollPane, gbc_scrollPane); txt_encryptContent = new JTextArea(); txt_encryptContent.setLineWrap(true); scrollPane.setViewportView(txt_encryptContent); // txt_encryptContent = new JTextArea(20, 20); // GridBagConstraints gbc_6 = new GridBagConstraints(); // gbc_6.gridx = 1; // gbc_6.gridy = 10; // this.add(txt_encryptContent, gbc_6); }
From source file:org.pentaho.reporting.engine.classic.core.modules.gui.pdf.PdfExportDialog.java
private JPanel createExportPanel() { final JButton btnSelect = new JButton(new ActionSelectFile(getResources())); final JLabel lblFileName = new JLabel(getResources().getString("pdfsavedialog.filename")); //$NON-NLS-1$ final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new GridBagLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3)); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0;// w w w . ja v a 2s .co m gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(3, 3, 1, 1); mainPanel.add(lblFileName, gbc); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1; gbc.gridx = 1; gbc.gridy = 0; gbc.ipadx = 120; gbc.insets = new Insets(3, 1, 1, 1); mainPanel.add(txFilename, gbc); gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.gridx = 2; gbc.gridy = 0; mainPanel.add(btnSelect, gbc); final JPanel advancedPaneCarrier = new JPanel(); advancedPaneCarrier.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); advancedPaneCarrier.setLayout(new BorderLayout()); advancedPaneCarrier.add(mainPanel, BorderLayout.NORTH); return advancedPaneCarrier; }
From source file:com.vgi.mafscaling.LogPlay.java
private JCheckBox addCheckBox(int column, String text) { JCheckBox check = new JCheckBox(text); check.addActionListener(this); GridBagConstraints gbc_check = new GridBagConstraints(); gbc_check.insets = insets0;//ww w. ja va2 s . co m gbc_check.anchor = GridBagConstraints.WEST; gbc_check.gridx = column; gbc_check.gridy = 1; playerPanel.add(check, gbc_check); return check; }
From source file:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java
/** * This method initializes jPanelThirdTitle * /* w w w . jav a 2s . c o m*/ * @return javax.swing.JPanel */ private JPanel getJPanelThirdTitle() { if (jPanelThirdTitle == null) { GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.anchor = GridBagConstraints.WEST; gridBagConstraints12.gridy = 0; gridBagConstraints12.insets = new Insets(0, 10, 0, 0); gridBagConstraints12.gridx = 1; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.anchor = GridBagConstraints.WEST; gridBagConstraints11.gridx = -1; gridBagConstraints11.gridy = -1; gridBagConstraints11.weighty = 0.0; gridBagConstraints11.gridwidth = 1; jPanelThirdTitle = new JPanel(); jPanelThirdTitle.setLayout(new GridBagLayout()); jPanelThirdTitle.add(getJRadioButtonThird(), gridBagConstraints11); jPanelThirdTitle.add(getJButtonThird(), gridBagConstraints12); } return jPanelThirdTitle; }
From source file:com.sec.ose.osi.ui.frm.main.identification.stringmatch.JPanStringMatchMain.java
/** * This method initializes jPanel /* ww w . j a va 2 s .com*/ * * @return javax.swing.JPanel */ private JPanel getJPanelThisFileIsFolderTitle() { if (jPanelThisFileIsFolderTitle == null) { GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.gridx = 1; gridBagConstraints9.insets = new Insets(3, 10, 0, 0); gridBagConstraints9.gridy = 0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.insets = new Insets(3, 0, 0, 0); gridBagConstraints.gridwidth = 1; gridBagConstraints.gridx = -1; gridBagConstraints.gridy = -1; gridBagConstraints.weightx = 0.0; gridBagConstraints.fill = GridBagConstraints.NONE; jPanelThisFileIsFolderTitle = new JPanel(); jPanelThisFileIsFolderTitle.setLayout(new GridBagLayout()); jPanelThisFileIsFolderTitle.add(getJRadioButtonThisFileIs(), gridBagConstraints); jPanelThisFileIsFolderTitle.add(getJButtonLicenseFolder(), gridBagConstraints9); } return jPanelThisFileIsFolderTitle; }
From source file:net.sf.jabref.gui.ContentSelectorDialog2.java
private void initLayout() { fieldNameField.setEnabled(false);/*from w w w. j ava 2 s. c o m*/ fieldList.setVisibleRowCount(4); wordList.setVisibleRowCount(10); final String VAL = "Uren luren himmelturen, ja Besseggen."; fieldList.setPrototypeCellValue(VAL); wordList.setPrototypeCellValue(VAL); fieldPan.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("Field name"))); wordPan.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("Keyword"))); fieldPan.setLayout(gbl); wordPan.setLayout(gbl); con.insets = new Insets(2, 2, 2, 2); con.fill = GridBagConstraints.BOTH; con.gridwidth = 2; con.weightx = 1; con.weighty = 1; con.gridx = 0; con.gridy = 0; gbl.setConstraints(fPane, con); fieldPan.add(fPane); gbl.setConstraints(wPane, con); wordPan.add(wPane); con.gridwidth = 1; con.gridx = 2; //con.weightx = 0.7; con.gridheight = 2; gbl.setConstraints(fieldNamePan, con); fieldPan.add(fieldNamePan); gbl.setConstraints(wordEditPan, con); wordPan.add(wordEditPan); con.gridx = 0; con.gridy = 1; con.weightx = 0; con.weighty = 0; con.gridwidth = 1; con.gridheight = 1; con.fill = GridBagConstraints.NONE; con.anchor = GridBagConstraints.WEST; gbl.setConstraints(newField, con); fieldPan.add(newField); gbl.setConstraints(newWord, con); wordPan.add(newWord); con.gridx = 1; //con.anchor = GridBagConstraints.EAST; gbl.setConstraints(removeField, con); fieldPan.add(removeField); gbl.setConstraints(removeWord, con); wordPan.add(removeWord); con.anchor = GridBagConstraints.WEST; con.gridx = 0; con.gridy = 0; gbl.setConstraints(fieldNameField, con); fieldNamePan.add(fieldNameField); gbl.setConstraints(wordEditField, con); wordEditPan.add(wordEditField); // Add buttons: ButtonBarBuilder bsb = new ButtonBarBuilder(buttonPan); bsb.addGlue(); bsb.addButton(ok); bsb.addButton(apply); bsb.addButton(cancel); bsb.addRelatedGap(); bsb.addButton(new HelpAction(HelpFile.CONTENT_SELECTOR).getHelpButton()); bsb.addGlue(); // Add panels to dialog: con.fill = GridBagConstraints.BOTH; getContentPane().setLayout(gbl); con.weightx = 1; con.weighty = 0.5; con.gridwidth = 1; con.gridheight = 1; con.gridx = 0; con.gridy = 0; gbl.setConstraints(fieldPan, con); getContentPane().add(fieldPan); con.gridy = 1; gbl.setConstraints(wordPan, con); getContentPane().add(wordPan); con.weighty = 0; con.gridy = 2; con.insets = new Insets(12, 2, 2, 2); gbl.setConstraints(buttonPan, con); getContentPane().add(buttonPan); }
From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.SearchPanel.java
/** * Builds and lays out the component displaying the various types. * // w ww.j a v a2s.c o m * @return See above. */ private JPanel buildType() { JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new GridBagLayout()); // p.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.WEST; c.fill = GridBagConstraints.HORIZONTAL; c.insets = new Insets(3, 3, 3, 3); List<SearchObject> nodes = model.getTypes(); List<Integer> ctxNodes = null; SearchContext ctx = model.getSearchContext(); if (ctx != null) ctxNodes = ctx.getType(); SearchObject n; int m = nodes.size(); JCheckBox box; c.weightx = 1.0; if (ctxNodes == null) { for (int i = 0; i < m; i++) { n = nodes.get(i); box = new JCheckBox(n.getDescription()); box.setBackground(UIUtilities.BACKGROUND_COLOR); box.setSelected(true); p.add(box, c); if (i % 2 == 0) c.gridy++; types.put(n.getIndex(), box); } } else { for (int i = 0; i < m; i++) { n = nodes.get(i); box = new JCheckBox(n.getDescription()); box.setBackground(UIUtilities.BACKGROUND_COLOR); box.setSelected(ctxNodes.contains(n.getIndex())); p.add(box, c); if (i % 2 == 0) c.gridy++; types.put(n.getIndex(), box); } } UIUtilities.setBoldTitledBorder(TYPE_TITLE, p); return p; }
From source file:unikn.dbis.univis.explorer.VExplorer.java
License:asdf
private void initStatePanel() { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0;// w w w .j av a 2 s.co m gbc.gridy = 0; gbc.anchor = GridBagConstraints.WEST; chartLabel = new VLabel(Constants.CHART); whatChartLabel = new VLabel(Constants.BAR_CHART_HORIZONTAL); complete = new JPanel(); complete.add(chartLabel); complete.add(whatChartLabel); statePanel.add(complete, gbc); measureLabel = new VLabel(Constants.MEASURE); complete = new JPanel(); complete.add(measureLabel); complete.add(tree.getWhatMeasureLabel()); ++gbc.gridy; statePanel.add(complete, gbc); languageLabel = new VLabel(Constants.LANGUAGE); whatLanguageLabel = new JLabel(Locale.GERMAN.getDisplayName()); complete = new JPanel(); complete.add(languageLabel); complete.add(whatLanguageLabel); ++gbc.gridy; statePanel.add(complete, gbc); timeLabel = new VLabel(Constants.TIME); whatTimeLabel = new VClock(); complete = new JPanel(); complete.add(timeLabel); complete.add(whatTimeLabel); ++gbc.gridy; statePanel.add(complete, gbc); dateLabel = new VLabel(Constants.DATE); whatDateLabel = new JLabel(whatTimeLabel.getDate()); complete = new JPanel(); complete.add(dateLabel); complete.add(whatDateLabel); ++gbc.gridy; statePanel.add(complete, gbc); StackedBox box = new StackedBox(); box.addBox("Status", statePanel, BorderLayout.WEST); underStatePanel.add(box, BorderLayout.CENTER); }
From source file:be.agiv.security.demo.Main.java
private void showPreferences() { JTabbedPane tabbedPane = new JTabbedPane(); GridBagLayout proxyGridBagLayout = new GridBagLayout(); GridBagConstraints proxyGridBagConstraints = new GridBagConstraints(); JPanel proxyPanel = new JPanel(proxyGridBagLayout) { private static final long serialVersionUID = 1L; @Override// www .ja va 2 s . c om public Insets getInsets() { return new Insets(10, 10, 10, 10); } }; tabbedPane.addTab("Proxy", proxyPanel); JCheckBox proxyEnableCheckBox = new JCheckBox("Enable proxy", this.proxyEnable); proxyGridBagConstraints.gridx = 0; proxyGridBagConstraints.gridy = 0; proxyGridBagConstraints.anchor = GridBagConstraints.WEST; proxyGridBagConstraints.ipadx = 5; proxyGridBagConstraints.gridwidth = GridBagConstraints.REMAINDER; proxyGridBagLayout.setConstraints(proxyEnableCheckBox, proxyGridBagConstraints); proxyPanel.add(proxyEnableCheckBox); proxyGridBagConstraints.gridwidth = 1; JLabel proxyHostLabel = new JLabel("Host:"); proxyGridBagConstraints.gridx = 0; proxyGridBagConstraints.gridy++; proxyGridBagLayout.setConstraints(proxyHostLabel, proxyGridBagConstraints); proxyPanel.add(proxyHostLabel); JTextField proxyHostTextField = new JTextField(this.proxyHost, 20); proxyGridBagConstraints.gridx++; proxyGridBagLayout.setConstraints(proxyHostTextField, proxyGridBagConstraints); proxyPanel.add(proxyHostTextField); JLabel proxyPortLabel = new JLabel("Port:"); proxyGridBagConstraints.gridx = 0; proxyGridBagConstraints.gridy++; proxyGridBagLayout.setConstraints(proxyPortLabel, proxyGridBagConstraints); proxyPanel.add(proxyPortLabel); JTextField proxyPortTextField = new JTextField(Integer.toString(this.proxyPort), 8); proxyGridBagConstraints.gridx++; proxyGridBagLayout.setConstraints(proxyPortTextField, proxyGridBagConstraints); proxyPanel.add(proxyPortTextField); JLabel proxyTypeLabel = new JLabel("Type:"); proxyGridBagConstraints.gridx = 0; proxyGridBagConstraints.gridy++; proxyGridBagLayout.setConstraints(proxyTypeLabel, proxyGridBagConstraints); proxyPanel.add(proxyTypeLabel); JComboBox proxyTypeComboBox = new JComboBox(new Object[] { Proxy.Type.HTTP, Proxy.Type.SOCKS }); proxyTypeComboBox.setSelectedItem(this.proxyType); proxyGridBagConstraints.gridx++; proxyGridBagLayout.setConstraints(proxyTypeComboBox, proxyGridBagConstraints); proxyPanel.add(proxyTypeComboBox); int dialogResult = JOptionPane.showConfirmDialog(this, tabbedPane, "Preferences", JOptionPane.OK_CANCEL_OPTION); if (dialogResult == JOptionPane.CANCEL_OPTION) { return; } this.statusBar.setStatus("Applying new preferences..."); this.proxyHost = proxyHostTextField.getText(); this.proxyPort = Integer.parseInt(proxyPortTextField.getText()); this.proxyType = (Proxy.Type) proxyTypeComboBox.getSelectedItem(); this.proxyEnable = proxyEnableCheckBox.isSelected(); }