List of usage examples for javax.swing BorderFactory createEtchedBorder
public static Border createEtchedBorder(int type)
From source file:org.mbs3.juniuploader.gui.pnlFormVariables.java
private void initGUI() { try {/*from w ww. j a v a 2 s .c om*/ GridBagLayout thisLayout = new GridBagLayout(); this.setLayout(thisLayout); { btnAddPair = new JButton(); this.add(btnAddPair, new GridBagConstraints(3, 3, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); btnAddPair.setText("Add a New Pair"); btnAddPair.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnAddPairActionPerformed(evt); } }); } { btnRemPair = new JButton(); this.add(btnRemPair, new GridBagConstraints(3, 6, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); btnRemPair.setText("Remove Selected Pair"); btnRemPair.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnRemPairActionPerformed(evt); } }); } { cmbFormGroups = new JComboBox(); this.add(cmbFormGroups, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cmbFormGroups.setModel(frmMain.formGroups); cmbFormGroups.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent evt) { cmbFormGroupsItemStateChanged(evt); } }); } { DefaultComboBoxModel groups = frmMain.formGroups; FormPairGroup fpg = (FormPairGroup) groups.getSelectedItem(); DefaultComboBoxModel dcbmFormPairs; if (fpg != null) dcbmFormPairs = new DefaultComboBoxModel(fpg.getPairs()); else dcbmFormPairs = new DefaultComboBoxModel(); lstFormPairValues = new JList(); lstFormPairValues.setModel(dcbmFormPairs); this.add(lstFormPairValues, new GridBagConstraints(1, 3, 1, 4, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); lstFormPairValues.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); } { btnAddGroup = new JButton(); this.add(btnAddGroup, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); btnAddGroup.setText("Add a Group"); btnAddGroup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnAddGroupActionPerformed(evt); } }); } { btnRemSelGrp = new JButton(); this.add(btnRemSelGrp, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); btnRemSelGrp.setText("Remove This Group"); btnRemSelGrp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnRemSelGrpActionPerformed(evt); } }); } { btnEditPair = new JButton(); this.add(btnEditPair, new GridBagConstraints(3, 4, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); btnEditPair.setText("Edit This Pair"); btnEditPair.setEnabled(false); } thisLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.1, 0.1, 0.0, 0.1, 0.0 }; thisLayout.rowHeights = new int[] { 8, 24, 9, 20, 7, 8, 7, 9 }; thisLayout.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; thisLayout.columnWidths = new int[] { 11, 335, 9, 97, 10, 119, 10 }; this.setPreferredSize(new java.awt.Dimension(614, 382)); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.mbs3.juniuploader.gui.pnlUploadSites.java
private void initGUI() { try {/*w w w . j av a 2s . c o m*/ GridBagLayout thisLayout = new GridBagLayout(); this.setLayout(thisLayout); { btnAddSite = new JButton(); this.add(btnAddSite, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); btnAddSite.setText("Add Site to List"); btnAddSite.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnAddSiteActionPerformed(evt); } }); } { btnRemoveSite = new JButton(); this.add(btnRemoveSite, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); btnRemoveSite.setText("Remove Selected Site"); btnRemoveSite.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnRemoveSiteActionPerformed(evt); } }); } { jScrollPane1 = new JScrollPane(); this.add(jScrollPane1, new GridBagConstraints(1, 1, 1, 4, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jScrollPane1.setPreferredSize(new java.awt.Dimension(367, 362)); { lstUploadSites = new JList(); jScrollPane1.setViewportView(lstUploadSites); lstUploadSites.setModel(frmMain.uploadLocations); lstUploadSites.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); } } thisLayout.rowWeights = new double[] { 0.0, 0.1, 0.1, 0.0, 0.1, 0.0 }; thisLayout.rowHeights = new int[] { 9, 20, 7, 8, 7, 9 }; thisLayout.columnWeights = new double[] { 0.0, 0.1, 0.0, 0.0, 0.0 }; thisLayout.columnWidths = new int[] { 11, 20, 9, 217, 11 }; this.setPreferredSize(new java.awt.Dimension(614, 382)); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.mbs3.juniuploader.gui.pnlWoWDirectories.java
private void initGUI() { try {/*from www . j av a 2 s .co m*/ GridBagLayout thisLayout = new GridBagLayout(); this.setLayout(thisLayout); { /*dlmWoWDirs = new DefaultListModel(); Vector dirs = frmMain.getUploader().getLocalSystem().getWowDirectories(); Iterator i = dirs.iterator(); while(i.hasNext()) dlmWoWDirs.addElement(i.next()); */ lstWoWDirs = new JList(); //dlmWoWDirs); lstWoWDirs.setModel(frmMain.wowDirectories); this.add(lstWoWDirs, new GridBagConstraints(1, 1, 1, 4, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); lstWoWDirs.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED)); } { btnAddDirectory = new JButton(); this.add(btnAddDirectory, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); btnAddDirectory.setText("Add Directory to List"); btnAddDirectory.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnAddDirectoryActionPerformed(evt); } }); } { btnRemoveSelected = new JButton(); this.add(btnRemoveSelected, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); btnRemoveSelected.setText("Remove Selected Directory"); btnRemoveSelected.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { btnRemoveSelectedActionPerformed(evt); } }); } thisLayout.rowWeights = new double[] { 0.0, 0.1, 0.1, 0.0, 0.1, 0.0 }; thisLayout.rowHeights = new int[] { 9, 20, 7, 8, 7, 9 }; thisLayout.columnWeights = new double[] { 0.0, 0.1, 0.0, 0.0, 0.0 }; thisLayout.columnWidths = new int[] { 11, 20, 9, 217, 11 }; this.setPreferredSize(new java.awt.Dimension(614, 382)); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.photovault.swingui.PhotoInfoEditor.java
protected void createUI() { setLayout(new BorderLayout()); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); tabPane = new JTabbedPane(); add(tabPane, BorderLayout.CENTER); // General pane JPanel generalPane = new JPanel(); tabPane.addTab("General", generalPane); // Create the fields & their labels // Photographer field JLabel photographerLabel = new JLabel("Photographer"); photographerField = createMvTextField("photographer", 30); photographerDoc = photographerField.getDocument(); // "Fuzzy time" field JLabel fuzzyDateLabel = new JLabel("Shooting date"); fuzzyDateField = new JTextField(30); fuzzyDateDoc = fuzzyDateField.getDocument(); fuzzyDateDoc.putProperty(FIELD, PhotoInfoFields.FUZZY_SHOOT_TIME); fuzzyDateDoc.addDocumentListener(this); JLabel qualityLabel = new JLabel("Quality"); qualityField = new JComboBox(qualityStrings); qualityField.addActionListener(this); StarRating qualityStars = new StarRating(5); FieldController<Integer> qfCtrl = ctrl.getFieldController("quality"); ValueModel qualityFieldValue = new PropertyAdapter(qfCtrl, "value", true); ValueModel starCount = new PropertyAdapter(qualityStars, "selection", true); PropertyConnector.connect(qualityFieldValue, "value", starCount, "value"); // Shooting place field JLabel shootingPlaceLabel = new JLabel("Shooting place"); shootingPlaceField = createMvTextField("shotLocation.description", 30); shootingPlaceDoc = shootingPlaceField.getDocument(); JLabel shotLocRoadLabel = new JLabel("Road"); JTextField shotLocRoadField = createMvTextField("shotLocation.road", 30); JLabel shotLocSuburbLabel = new JLabel("Suburb"); JTextField shotLocSuburbField = createMvTextField("shotLocation.suburb", 30); JLabel shotLocCityLabel = new JLabel("City"); JTextField shotLocCityField = createMvTextField("shotLocation.city", 30); JLabel shotLocCountryLabel = new JLabel("Country"); JTextField shotLocCountryField = createMvTextField("shotLocation.country", 30); JLabel shotLocGeohashLabel = new JLabel("Geohash code"); JTextField shotLocGeohashField = createMvTextField("shotLocation.geoHashString", 30); shotLocGeohashField.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "fillAddress"); shotLocGeohashField.getActionMap().put("fillAddress", new FindAddressAction(ctrl)); // Tags// ww w .j a v a 2 s .c o m JLabel tagLabel = new JLabel("Tags"); tagList = new TagList2(ctrl.getTagController()); tagList.setBackground(generalPane.getBackground()); // Description text JLabel descLabel = new JLabel("Description"); descriptionTextArea = new JTextArea(5, 40); descriptionTextArea.setLineWrap(true); descriptionTextArea.setWrapStyleWord(true); JScrollPane descScrollPane = new JScrollPane(descriptionTextArea); descScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); Border descBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); descBorder = BorderFactory.createTitledBorder(descBorder, "Description"); descScrollPane.setBorder(descBorder); descriptionDoc = descriptionTextArea.getDocument(); descriptionDoc.putProperty(FIELD, PhotoInfoFields.DESCRIPTION); descriptionDoc.addDocumentListener(this); // Lay out the created controls GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); generalPane.setLayout(layout); JLabel[] labels = { photographerLabel, fuzzyDateLabel, shootingPlaceLabel, shotLocGeohashLabel, shotLocRoadLabel, shotLocSuburbLabel, shotLocCityLabel, shotLocCountryLabel, qualityLabel, tagLabel }; JComponent[] fields = { photographerField, fuzzyDateField, shootingPlaceField, shotLocGeohashField, shotLocRoadField, shotLocSuburbField, shotLocCityField, shotLocCountryField, qualityStars, tagList }; addLabelTextRows(labels, fields, layout, generalPane); c = layout.getConstraints(tagList); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.0; c.weighty = 1.0; layout.setConstraints(tagList, c); generalPane.add(descScrollPane); c.gridwidth = GridBagConstraints.REMAINDER; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; layout.setConstraints(descScrollPane, c); c = new GridBagConstraints(); c.gridwidth = 1; c.weighty = 0; c.fill = GridBagConstraints.NONE; c.gridy = GridBagConstraints.RELATIVE; c.gridy = GridBagConstraints.RELATIVE; createTechDataUI(); createFolderPaneUI(); createRightsUI(); }
From source file:org.photovault.swingui.PhotoInfoEditor.java
protected void createTechDataUI() { JPanel pane = new JPanel(); tabPane.addTab("Tech data", pane); JLabel cameraMakerLabel = new JLabel("Camera make"); JTextField cameraMakerField = createMvTextField("cameraMaker", 20); // cameraDoc = cameraField.getDocument(); JLabel cameraLabel = new JLabel("Camera model"); cameraField = createMvTextField("camera", 20); cameraDoc = cameraField.getDocument(); JLabel lensLabel = new JLabel("Lens"); lensField = createMvTextField("lens", 20); lensDoc = lensField.getDocument();//w ww . j ava 2 s . c om JLabel filmLabel = new JLabel("Film"); filmField = createMvTextField("film", 20); filmDoc = filmField.getDocument(); JLabel filmSpeedLabel = new JLabel("Film speed"); NumberFormatter filmSpeedFormatter = new NumberFormatter(new DecimalFormat("#########0")); filmSpeedFormatter.setValueClass(PhotoInfoFields.FILM_SPEED.getType()); filmSpeedField = new JFormattedTextField(filmSpeedFormatter); filmSpeedField.setColumns(5); filmSpeedField.addPropertyChangeListener(this); filmSpeedField.putClientProperty(FIELD, PhotoInfoFields.FILM_SPEED); JLabel shutterSpeedLabel = new JLabel("Shutter speed"); DecimalFormat shutterSpeedFormat = new DecimalFormat("###0.####"); NumberFormatter shutterSpeedFormatter = new NumberFormatter(shutterSpeedFormat); shutterSpeedFormatter.setValueClass(PhotoInfoFields.SHUTTER_SPEED.getType()); shutterSpeedField = new JFormattedTextField(shutterSpeedFormatter); shutterSpeedField.setColumns(5); shutterSpeedField.addPropertyChangeListener(this); shutterSpeedField.putClientProperty(FIELD, PhotoInfoFields.SHUTTER_SPEED); JLabel fStopLabel = new JLabel("F-stop"); DecimalFormat fStopFormat = new DecimalFormat("#0.#"); NumberFormatter fStopFormatter = new NumberFormatter(fStopFormat); fStopFormatter.setValueClass(PhotoInfoFields.FSTOP.getType()); fStopField = new JFormattedTextField(fStopFormatter); fStopField.setColumns(5); fStopField.addPropertyChangeListener(this); fStopField.putClientProperty(FIELD, PhotoInfoFields.FSTOP); JLabel focalLengthLabel = new JLabel("Focal length"); NumberFormatter focalLengthFormatter = new NumberFormatter(new DecimalFormat("#######0.#")); focalLengthFormatter.setValueClass(PhotoInfoFields.FSTOP.getType()); focalLengthField = new JFormattedTextField(focalLengthFormatter); focalLengthField.setColumns(5); focalLengthField.addPropertyChangeListener(this); focalLengthField.putClientProperty(FIELD, PhotoInfoFields.FOCAL_LENGTH); // Tech note text JLabel notesLabel = new JLabel("Tech. notes"); technoteTextArea = new JTextArea(5, 40); technoteTextArea.setLineWrap(true); technoteTextArea.setWrapStyleWord(true); JScrollPane technoteScrollPane = new JScrollPane(technoteTextArea); technoteScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); Border technoteBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); technoteBorder = BorderFactory.createTitledBorder(technoteBorder, "Description"); technoteScrollPane.setBorder(technoteBorder); technoteDoc = technoteTextArea.getDocument(); technoteDoc.putProperty(FIELD, PhotoInfoFields.TECH_NOTES); technoteDoc.addDocumentListener(this); // Lay out the created controls GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); pane.setLayout(layout); JLabel[] labels = { cameraMakerLabel, cameraLabel, lensLabel, focalLengthLabel, filmLabel, filmSpeedLabel, shutterSpeedLabel, fStopLabel }; JTextField[] fields = { cameraMakerField, cameraField, lensField, focalLengthField, filmField, filmSpeedField, shutterSpeedField, fStopField }; addLabelTextRows(labels, fields, layout, pane); pane.add(technoteScrollPane); c.gridwidth = GridBagConstraints.REMAINDER; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; layout.setConstraints(technoteScrollPane, c); }
From source file:org.photovault.swingui.PhotoInfoEditor.java
private void createRightsUI() { JPanel pane = new JPanel(); tabPane.addTab("Rights", pane); JLabel copyrightLabel = new JLabel("Copyright"); JTextField copyrightField = createMvTextField("usageRights.copyright", 30); JLabel attributionLabel = new JLabel("Name for attribution"); JTextField attributionField = createMvTextField("usageRights.attributionName", 30); JLabel attributionUrlLabel = new JLabel("Url for attribution"); JTextField attributionUrlField = createMvTextField("usageRights.attributionUrl", 30); JLabel licenseLabel = new JLabel("License"); List<License> licenses = new ArrayList(); licenses.addAll(EnumSet.allOf(License.class)); JComboBox licenseCombo = createMvComboBox("usageRights.license", licenses); // Tech note text JLabel termsLabel = new JLabel("Usage terms"); JTextArea termsTextArea = createMvTextArea("usageRights.usageTerms", 5, 40); termsTextArea.setLineWrap(true);//from w ww. j a va2 s.c o m termsTextArea.setWrapStyleWord(true); JScrollPane termsScrollPane = new JScrollPane(termsTextArea); termsScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); Border termsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); termsBorder = BorderFactory.createTitledBorder(termsBorder, "Usage terms"); termsScrollPane.setBorder(termsBorder); GridBagLayout layout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); pane.setLayout(layout); JLabel[] labels = { copyrightLabel, licenseLabel, attributionLabel, attributionUrlLabel }; JComponent[] fields = { copyrightField, licenseCombo, attributionField, attributionUrlField }; addLabelTextRows(labels, fields, layout, pane); pane.add(termsScrollPane); c.gridwidth = GridBagConstraints.REMAINDER; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; layout.setConstraints(termsScrollPane, c); }
From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewer.java
private void initComponents() { setLayout(new BorderLayout()); // create button panel JPanel topPanel = new JPanel(); btnTreeView = new JRadioButton("Tree"); btnTreeView.putClientProperty("cv.cardName", TREEPANEL); btnTableView = new JRadioButton("Table"); btnTableView.putClientProperty("cv.cardName", TABLEPANEL); ActionListener btnListener = new ActionListener() { public void actionPerformed(ActionEvent e) { // show the right layout panel String v = (String) ((AbstractButton) e.getSource()).getClientProperty("cv.cardName"); if (v != null) ((CardLayout) contentPanel.getLayout()).show(contentPanel, v); }/* w w w .ja va 2 s . co m*/ }; btnTableView.addActionListener(btnListener); btnTreeView.addActionListener(btnListener); // connect buttons ButtonGroup group = new ButtonGroup(); group.add(btnTreeView); group.add(btnTableView); topPanel.setLayout(new MigLayout("", "[64px][55px][62px][grow]", "[][23px]")); lblViewAllThe = new JLabel( "<html>View all the component series that combine to create the current series. Series can be viewed as:"); topPanel.add(lblViewAllThe, "cell 0 0 4 1"); JRadioButton btnTree2View = new JRadioButton("Flow chart"); btnTree2View.putClientProperty("cv.cardName", TREE2PANEL); btnTree2View.addActionListener(btnListener); group.add(btnTree2View); topPanel.add(btnTree2View, "cell 0 1,alignx left,aligny center"); topPanel.add(btnTreeView, "cell 1 1,alignx left,aligny center"); topPanel.add(btnTableView, "cell 2 1,alignx left,aligny center"); topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8)); add(topPanel, BorderLayout.NORTH); // create status bar JPanel status = new JPanel(); status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS)); txtStatus = new JLabel(""); pbStatus = new JProgressBar(); pbStatus.setVisible(false); status.add(txtStatus); status.add(Box.createHorizontalStrut(8)); status.add(pbStatus); status.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); add(status, BorderLayout.SOUTH); contentPanel = new JPanel(new CardLayout()); add(contentPanel, BorderLayout.CENTER); tablePanel = new JPanel(new BorderLayout()); setupTable(); tablePanel.add(new JScrollPane(table), BorderLayout.CENTER); treePanel = new JPanel(new BorderLayout()); setupTree(); treePanel.add(new JScrollPane(tree), BorderLayout.CENTER); tree2Panel = new JPanel(new BorderLayout()); setupTreeGUI(); contentPanel.add(tablePanel, TABLEPANEL); contentPanel.add(treePanel, TREEPANEL); contentPanel.add(tree2Panel, TREE2PANEL); }
From source file:org.tellervo.desktop.tridasv2.ui.ComponentViewerOld.java
private void initComponents() { JLabel label;//from www .jav a2 s .co m setLayout(new BorderLayout()); // create button panel JPanel topPanel = new JPanel(); label = new JLabel("View as: "); btnTreeView = new JRadioButton("tree"); btnTreeView.putClientProperty("cv.cardName", TREEPANEL); btnTableView = new JRadioButton("table"); btnTableView.putClientProperty("cv.cardName", TABLEPANEL); ActionListener btnListener = new ActionListener() { public void actionPerformed(ActionEvent e) { // show the right layout panel String v = (String) ((AbstractButton) e.getSource()).getClientProperty("cv.cardName"); if (v != null) ((CardLayout) contentPanel.getLayout()).show(contentPanel, v); } }; btnTableView.addActionListener(btnListener); btnTreeView.addActionListener(btnListener); // connect buttons ButtonGroup group = new ButtonGroup(); group.add(btnTreeView); group.add(btnTableView); topPanel.setLayout(new MigLayout("", "[64px][55px][62px][63px][][]", "[23px]")); // add it all to a panel topPanel.add(label, "cell 0 0,alignx left,aligny center"); topPanel.add(btnTreeView, "cell 1 0,alignx left,aligny center"); topPanel.add(btnTableView, "cell 2 0,alignx left,aligny center"); topPanel.setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8)); add(topPanel, BorderLayout.NORTH); JButton btnOrder = new JButton("Order"); btnOrder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { } }); topPanel.add(btnOrder, "cell 5 0"); // create status bar JPanel status = new JPanel(); status.setLayout(new BoxLayout(status, BoxLayout.X_AXIS)); txtStatus = new JLabel(""); pbStatus = new JProgressBar(); pbStatus.setVisible(false); status.add(txtStatus); status.add(Box.createHorizontalStrut(8)); status.add(pbStatus); status.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); add(status, BorderLayout.SOUTH); contentPanel = new JPanel(new CardLayout()); add(contentPanel, BorderLayout.CENTER); tablePanel = new JPanel(new BorderLayout()); setupTable(); tablePanel.add(new JScrollPane(table), BorderLayout.CENTER); treePanel = new JPanel(new BorderLayout()); setupTree(); treePanel.add(new JScrollPane(tree), BorderLayout.CENTER); tree2Panel = new JPanel(new BorderLayout()); createTree(); //setupTreeGUI(); contentPanel.add(tablePanel, TABLEPANEL); contentPanel.add(treePanel, TREEPANEL); contentPanel.add(tree2Panel, TREE2PANEL); }
From source file:org.zaproxy.zap.extension.customFire.TechnologyTreePanel.java
public TechnologyTreePanel(String nameRootNode) { setLayout(new BorderLayout()); techToNodeMap = new HashMap<>(); techTree = new JCheckBoxScriptsTree() { private static final long serialVersionUID = 1L; @Override/*from w w w . jav a2s. co m*/ protected void setExpandedState(TreePath path, boolean state) { // Ignore all collapse requests; collapse events will not be fired if (state) { super.setExpandedState(path, state); } } }; // Initialise the structure based on all the tech we know about TechSet ts = new TechSet(Tech.builtInTech); Iterator<Tech> iter = ts.getIncludeTech().iterator(); DefaultMutableTreeNode root = new DefaultMutableTreeNode(nameRootNode); Tech tech; DefaultMutableTreeNode parent; DefaultMutableTreeNode node; while (iter.hasNext()) { tech = iter.next(); if (tech.getParent() != null) { parent = techToNodeMap.get(tech.getParent()); } else { parent = null; } if (parent == null) { parent = root; } node = new DefaultMutableTreeNode(tech.getUiName()); parent.add(node); techToNodeMap.put(tech, node); } techTree.setModel(new DefaultTreeModel(root)); techTree.expandAll(); techTree.setCheckBoxEnabled(new TreePath(root), false); reset(); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(techTree); scrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); add(scrollPane, BorderLayout.CENTER); }
From source file:org.zaproxy.zap.extension.quickstart.QuickStartPanel.java
private void initialize() { this.setIcon(new ImageIcon(BreakPanel.class.getResource("/resource/icon/16/147.png"))); // 'lightning' icon this.setDefaultAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | Event.SHIFT_MASK, false)); this.setMnemonic(Constant.messages.getChar("quickstart.panel.mnemonic")); this.setLayout(new BorderLayout()); JPanel panelContent = new JPanel(new GridBagLayout()); JScrollPane jScrollPane = new JScrollPane(); jScrollPane.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 11)); jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jScrollPane.setViewportView(panelContent); this.add(jScrollPane, BorderLayout.CENTER); panelContent.setBackground(Color.white); panelContent.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); /*/* w ww.j a v a2 s. c o m*/ * Layout: * Col 0 1 2 3 4 * Row+----------------------+----------------------+----------------------+----------------------+----------------------+ * 0 | Top welcome message | zap128x128.png | * 1 | URL: | [ Url field ] | | * 2 | | [ Attack button ] | [ Stop button ] | padding | | * 3 | Progress: | Progress details | | * | Bottom message | * | Show at start: | [x] | | | | * +----------------------+----------------------+----------------------+----------------------+----------------------+ */ panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.topmsg")), LayoutHelper.getGBC(0, 0, 4, 1.0D, new Insets(5, 5, 5, 5))); if (Constant.isDevBuild()) { panelContent.add( new JLabel(new ImageIcon(QuickStartPanel.class .getResource("/org/zaproxy/zap/extension/quickstart/resources/zap128x128dark.png"))), LayoutHelper.getGBC(4, 0, 1, 0.0D, 0.0D, GridBagConstraints.NORTH)); } else { panelContent.add( new JLabel(DisplayUtils.getScaledIcon( new ImageIcon(SearchPanel.class.getResource("/resource/zap128x128.png")))), LayoutHelper.getGBC(4, 0, 1, 0.0D, 0.0D, GridBagConstraints.NORTH)); } panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.url")), LayoutHelper.getGBC(0, 1, 1, 0.0D, new Insets(5, 5, 5, 5))); JPanel urlSelectPanel = new JPanel(new GridBagLayout()); JButton selectButton = new JButton(Constant.messages.getString("all.button.select")); selectButton.setIcon( DisplayUtils.getScaledIcon(new ImageIcon(View.class.getResource("/resource/icon/16/094.png")))); // Globe icon selectButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { NodeSelectDialog nsd = new NodeSelectDialog(View.getSingleton().getMainFrame()); SiteNode node = null; try { node = Model.getSingleton().getSession().getSiteTree() .findNode(new URI(getUrlField().getText(), false)); } catch (Exception e2) { // Ignore } node = nsd.showDialog(node); if (node != null && node.getHistoryReference() != null) { try { getUrlField().setText(node.getHistoryReference().getURI().toString()); } catch (Exception e1) { // Ignore } } } }); urlSelectPanel.add(this.getUrlField(), LayoutHelper.getGBC(0, 0, 1, 1.0D)); urlSelectPanel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D)); panelContent.add(urlSelectPanel, LayoutHelper.getGBC(1, 1, 3, 0.25D)); panelContent.add(this.getAttackButton(), LayoutHelper.getGBC(1, 2, 1, 0.0D)); panelContent.add(this.getStopButton(), LayoutHelper.getGBC(2, 2, 1, 0.0D)); panelContent.add(new JLabel(""), LayoutHelper.getGBC(3, 2, 1, 0.75D, 0.0D)); // Padding to right of buttons progressLabel = new JLabel( Constant.messages.getString("quickstart.progress." + AttackThread.Progress.notstarted.name())); panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.progress")), LayoutHelper.getGBC(0, 3, 1, 0.0D, new Insets(5, 5, 5, 5))); panelContent.add(this.progressLabel, LayoutHelper.getGBC(1, 3, 3, 0.0D)); panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.proxymsg")), LayoutHelper.getGBC(0, 4, 5, 1.0D, new Insets(5, 5, 5, 5))); if (Control.getSingleton().getExtensionLoader().getExtension("ExtensionPlugNHack") != null) { // Plug-n-Hack extension has been installed - this makes configuration much easier :) if (DesktopUtils.canOpenUrlInBrowser()) { panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitm")), LayoutHelper.getGBC(0, 6, 1, 0.0D, new Insets(5, 5, 5, 5))); panelContent.add(this.getConfButton(), LayoutHelper.getGBC(1, 6, 1, 0.0D)); panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitmalt")), LayoutHelper.getGBC(0, 7, 1, 0.0D, new Insets(5, 5, 5, 5))); } else { panelContent.add(new JLabel(Constant.messages.getString("quickstart.label.mitmurl")), LayoutHelper.getGBC(0, 7, 1, 0.0D, new Insets(5, 5, 5, 5))); } panelContent.add(this.getConfField(), LayoutHelper.getGBC(1, 7, 3, 0.25D)); } else { panelContent.add(new JLabel(Constant.messages.getString("quickstart.panel.helpmsg")), LayoutHelper.getGBC(0, 5, 5, 1.0D, new Insets(5, 5, 5, 5))); } panelContent.add(new JLabel(""), LayoutHelper.getGBC(0, 10, 4, 1.D, 1.0D)); // Padding at bottom this.setMode(Control.getSingleton().getMode()); }