List of usage examples for javax.swing JPanel setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
From source file:com.sshtools.common.ui.SshToolsConnectionProxyTab.java
/** * Creates a new SshToolsConnectionProxyTab object. *//*from w ww .j a v a 2 s. co m*/ public SshToolsConnectionProxyTab() { super(); group.add(noProxy); group.add(httpProxy); group.add(socks4Proxy); group.add(socks5Proxy); ChangeListener listener = new ChangeListener() { public void stateChanged(ChangeEvent e) { if (noProxy.isSelected()) { username.setEnabled(false); password.setEnabled(false); proxy.setEnabled(false); //port.setEnabled(false); port.setForeground(Color.white); } else { username.setEnabled(true); password.setEnabled(true); proxy.setEnabled(true); //port.setEnabled(true); port.setForeground(Color.black); if (httpProxy.isSelected()) { port.setText("80"); } else { port.setText("1080"); } } } }; noProxy.getModel().addChangeListener(listener); httpProxy.getModel().addChangeListener(listener); socks4Proxy.getModel().addChangeListener(listener); socks5Proxy.getModel().addChangeListener(listener); // Create the main connection details panel GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.NORTH; gbc.insets = new Insets(0, 2, 2, 2); gbc.weightx = 1.0; proxyframe.setBorder(BorderFactory.createTitledBorder("Connect using the following proxy")); // No proxy label gbc.insets = new Insets(2, 10, 2, 2); UIUtil.jGridBagAdd(proxyframe, noProxy, gbc, GridBagConstraints.RELATIVE); // Socks 4 label gbc.insets = new Insets(2, 15, 2, 2); UIUtil.jGridBagAdd(proxyframe, socks4Proxy, gbc, GridBagConstraints.REMAINDER); //gbc.fill = GridBagConstraints.HORIZONTAL; // Http Proxy gbc.insets = new Insets(2, 10, 2, 2); UIUtil.jGridBagAdd(proxyframe, httpProxy, gbc, GridBagConstraints.RELATIVE); // Socks 5 label gbc.insets = new Insets(2, 15, 2, 2); UIUtil.jGridBagAdd(proxyframe, socks5Proxy, gbc, GridBagConstraints.REMAINDER); gbc.insets = new Insets(2, 10, 2, 10); JPanel connect = new JPanel(new GridBagLayout()); connect.setBorder(BorderFactory.createTitledBorder("Proxy Details")); UIUtil.jGridBagAdd(connect, new JLabel("Host"), gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(connect, proxy, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(connect, new JLabel("Port"), gbc, GridBagConstraints.REMAINDER); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; UIUtil.jGridBagAdd(connect, port, gbc, GridBagConstraints.REMAINDER); gbc.fill = GridBagConstraints.HORIZONTAL; UIUtil.jGridBagAdd(connect, new JLabel("Username"), gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(connect, username, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(connect, new JLabel("Password"), gbc, GridBagConstraints.REMAINDER); gbc.insets = new Insets(2, 10, 10, 10); UIUtil.jGridBagAdd(connect, password, gbc, GridBagConstraints.REMAINDER); JPanel main = new JPanel(new GridBagLayout()); gbc.insets = new Insets(2, 2, 2, 2); UIUtil.jGridBagAdd(main, proxyframe, gbc, GridBagConstraints.REMAINDER); UIUtil.jGridBagAdd(main, connect, gbc, GridBagConstraints.REMAINDER); IconWrapperPanel iconProxyDetailsPanel = new IconWrapperPanel(new ResourceIcon(PROXY_ICON), main); noProxy.setSelected(true); // This panel setLayout(new BorderLayout()); 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; add(iconProxyDetailsPanel, BorderLayout.NORTH); }
From source file:CubaHSQLDBServer.java
private CubaHSQLDBServer() { Font monospaced = Font.decode("monospaced"); statusArea = new JTextArea(2, 80); statusArea.setFont(monospaced);/*from ww w .j a va 2s . com*/ statusArea.setMargin(new Insets(5, 5, 5, 5)); exceptionArea = new JTextArea(26, 80); exceptionArea.setFont(monospaced); exceptionArea.setMargin(new Insets(5, 5, 5, 5)); JPanel exceptionWrapperContainer = new JPanel(); exceptionWrapperContainer.setLayout(new BorderLayout(0, 0)); exceptionWrapperContainer.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); exceptionWrapperContainer.add(exceptionArea); JPanel statusWrapperContainer = new JPanel(); statusWrapperContainer.setLayout(new BorderLayout(0, 0)); statusWrapperContainer.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1)); statusWrapperContainer.add(statusArea); addCopyPopup(statusArea); addCopyPopup(exceptionArea); exceptionBox = new JPanel(); LayoutBuilder.create(exceptionBox, BoxLayout.Y_AXIS).addSpace(5).addComponent(exceptionWrapperContainer); LayoutBuilder.create(this.getContentPane(), BoxLayout.X_AXIS).addSpace(5).addContainer(BoxLayout.Y_AXIS) .addSpace(5).addComponent(statusWrapperContainer).addComponent(exceptionBox).addSpace(5) .returnToParent().addSpace(5); statusArea.setEditable(false); exceptionArea.setEditable(false); exceptionBox.setVisible(false); exceptionArea.setBackground(new Color(255, 255, 212)); this.pack(); this.setResizable(true); this.setTitle("HSQLDB Server"); try { this.setIconImage(ImageIO.read(getClass().getResourceAsStream("/icons/database.png"))); } catch (IOException e) { throw new IllegalStateException("Unable to find icon for HSQLDB window"); } }
From source file:gui.TwopointPWDPanel.java
private JPanel createControls() { // Marker model (for ordered list of markers) markerModel = new PWDTableModel(); // Populate the marker table markerTable = new JTable(markerModel); markerTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); markerTable.getColumnModel().getColumn(1).setPreferredWidth(175); markerTable.getColumnModel().getColumn(2).setPreferredWidth(60); for (CMarker cm : order.getLinkageGroup().getMarkers()) { markerModel.addRow(new Object[] { cm.marker.getPrefix(), cm, cm.marker.getRatio() }); }/*from w ww .j a va 2 s .c o m*/ markerTable.getSelectionModel().addListSelectionListener(this); // Phase model (for scores of each ordered marker against the others) phaseModel = new PWDTableModel2(); phaseModel.setColumnIdentifiers(new Object[] { "Graph Code", "Marker Name", "Recom Freq", "LOD Score" }); phaseTable = new JTable(phaseModel); phaseTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); phaseTable.getSelectionModel().addListSelectionListener(this); rfqChart = new PWDChartPanel("Recombination Freq"); lodChart = new PWDChartPanel("LOD Score"); m1Label = new JLabel(""); m1Label.setFont(new Font("Monospaced", Font.PLAIN, 11)); m2Label = new JLabel(""); m2Label.setFont(new Font("Monospaced", Font.PLAIN, 11)); JScrollPane mSP = new JScrollPane(markerTable); mSP.setPreferredSize(new Dimension(300, 10)); JPanel p1 = new JPanel(new BorderLayout(5, 0)); p1.add(new JLabel("Ordered Markers:"), BorderLayout.NORTH); p1.add(mSP); JPanel p2 = new JPanel(new BorderLayout(5, 0)); p2.add(new JLabel("Scores:"), BorderLayout.NORTH); p2.add(new JScrollPane(phaseTable)); JPanel p3 = new JPanel(new GridLayout(2, 1, 2, 2)); p3.setBorder(BorderFactory.createLoweredBevelBorder()); p3.add(m1Label); p3.add(m2Label); JPanel p4 = new JPanel(new GridLayout(1, 2, 5, 5)); p4.add(rfqChart); p4.add(lodChart); JPanel p5 = new JPanel(new BorderLayout(5, 5)); p5.add(p3, BorderLayout.NORTH); p5.add(p4, BorderLayout.CENTER); JSplitPane splits = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splits.setResizeWeight(0.5); splits.setLeftComponent(p1); splits.setRightComponent(p2); JPanel p6 = new JPanel(new BorderLayout(5, 5)); p6.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); p6.add(splits); p6.add(p5, BorderLayout.SOUTH); return p6; }
From source file:ExtendedDnDDemo.java
private JPanel createList() { DefaultListModel listModel = new DefaultListModel(); listModel.addElement("List 0"); listModel.addElement("List 1"); listModel.addElement("List 2"); listModel.addElement("List 3"); listModel.addElement("List 4"); listModel.addElement("List 5"); listModel.addElement("List 6"); listModel.addElement("List 7"); listModel.addElement("List 8"); JList list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); JScrollPane scrollPane = new JScrollPane(list); scrollPane.setPreferredSize(new Dimension(400, 100)); list.setDragEnabled(true);// ww w . j av a2 s .c o m list.setTransferHandler(new ListTransferHandler()); JPanel panel = new JPanel(new BorderLayout()); panel.add(scrollPane, BorderLayout.CENTER); panel.setBorder(BorderFactory.createTitledBorder("List")); return panel; }
From source file:org.obiba.onyx.jade.instrument.summitdoppler.VantageABIInstrumentRunner.java
/** * Build action buttons sub panel// w w w. jav a 2 s .c o m */ protected JPanel buildActionButtonSubPanel() { // Add the action buttons sub panel. JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); JButton cancelButton = new JButton(resourceBundle.getString("Cancel")); cancelButton.setMnemonic('A'); cancelButton.setToolTipText(resourceBundle.getString("ToolTip.Cancel_measurement")); panel.add(Box.createHorizontalGlue()); panel.add(saveButton); panel.add(Box.createRigidArea(new Dimension(10, 0))); panel.add(cancelButton); // Save button listener. saveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { sendOutputToServer(); } }); // Cancel button listener. cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { confirmOnExit(); } }); panel.setAlignmentX(Component.LEFT_ALIGNMENT); return (panel); }
From source file:InterleavedNIOBuffer.java
JPanel createGeometryByReferencePanel() { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder("Geometry Type")); String values[] = { "Array", "Strip", "Indexed", "IndexedStrip" }; geomType = new JComboBox(values); geomType.setLightWeightPopupEnabled(false); geomType.addActionListener(this); geomType.setSelectedIndex(0);//w ww . j a v a 2 s . co m panel.add(new JLabel("Geometry Type")); panel.add(geomType); transparency = new JCheckBox("EnableTransparency", false); transparency.addActionListener(this); panel.add(transparency); textureBox = new JCheckBox("EnableTexture", false); textureBox.addActionListener(this); panel.add(textureBox); return panel; }
From source file:ExtendedDnDDemo.java
private JPanel createTable() { DefaultTableModel model = new DefaultTableModel(); model.addColumn("Column 0"); model.addColumn("Column 1"); model.addColumn("Column 2"); model.addColumn("Column 3"); model.addRow(new String[] { "Table 00", "Table 01", "Table 02", "Table 03" }); model.addRow(new String[] { "Table 10", "Table 11", "Table 12", "Table 13" }); model.addRow(new String[] { "Table 20", "Table 21", "Table 22", "Table 23" }); model.addRow(new String[] { "Table 30", "Table 31", "Table 32", "Table 33" }); JTable table = new JTable(model); table.getTableHeader().setReorderingAllowed(false); table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); JScrollPane scrollPane = new JScrollPane(table); scrollPane.setPreferredSize(new Dimension(400, 100)); table.setDragEnabled(true);//from w w w . j a v a 2 s . c om table.setTransferHandler(new TableTransferHandler()); JPanel panel = new JPanel(new BorderLayout()); panel.add(scrollPane, BorderLayout.CENTER); panel.setBorder(BorderFactory.createTitledBorder("Table")); return panel; }
From source file:com.game.ui.views.PlayerEditor.java
public void doGui() { // setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setLayout(new GridBagLayout()); GridBagConstraints c1 = new GridBagConstraints(); c1.fill = GridBagConstraints.NONE; c1.anchor = GridBagConstraints.WEST; c1.insets = new Insets(10, 5, 10, 5); c1.weightx = 0;/*w w w. j av a 2 s . c om*/ c1.weighty = 0; JLabel noteLbl = new JLabel("Pls select a value to choose a Player or you can create a new " + "Player entity below. Once selected a Player character, its' details will be available below"); add(noteLbl, c1); DefaultComboBoxModel model = new DefaultComboBoxModel(); for (GameCharacter character : GameBean.playerDetails) { model.addElement(((Player) character).getType()); } c1.gridy = 1; comboBox = new JComboBox(model); comboBox.setSelectedIndex(-1); comboBox.setMaximumSize(new Dimension(100, 30)); comboBox.setActionCommand("dropDown"); comboBox.addActionListener(this); add(comboBox, c1); JPanel wrapperPanel = new JPanel(new GridLayout(1, 2, 10, 10)); wrapperPanel.setBorder(LineBorder.createGrayLineBorder()); leftPanel = new JPanel(); leftPanel.setAlignmentX(0); leftPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(5, 5, 5, 5); c.weightx = 1; c.weighty = 1; c.gridwidth = 2; JLabel enemyDtlLbl = new JLabel("Enemy Character Details : "); enemyDtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15)); leftPanel.add(enemyDtlLbl, c); c.gridwidth = 1; c.gridy = 1; JLabel nameLbl = new JLabel("Name : "); leftPanel.add(nameLbl, c); c.gridx = 1; JTextField name = new JTextField(""); name.setColumns(20); leftPanel.add(name, c); c.gridx = 0; c.gridy = 2; JLabel imageLbl = new JLabel("Image Path : "); leftPanel.add(imageLbl, c); c.gridx = 1; JTextField image = new JTextField(""); image.setColumns(20); leftPanel.add(image, c); c.gridx = 0; c.gridy = 3; JLabel healthLbl = new JLabel("Health Pts : "); leftPanel.add(healthLbl, c); c.gridx = 1; JTextField health = new JTextField(""); health.setColumns(20); leftPanel.add(health, c); c.gridx = 0; c.gridy = 4; JLabel attackPtsLbl = new JLabel("Attack Points : "); leftPanel.add(attackPtsLbl, c); c.gridx = 1; JTextField attackPts = new JTextField(""); attackPts.setColumns(20); leftPanel.add(attackPts, c); c.gridx = 0; c.gridy = 5; JLabel armoursPtsLbl = new JLabel("Armour Points : "); leftPanel.add(armoursPtsLbl, c); c.gridx = 1; JTextField armourPts = new JTextField(""); armourPts.setColumns(20); leftPanel.add(armourPts, c); c.gridx = 0; c.gridy = 6; JLabel attackRngeLbl = new JLabel("Attack Range : "); leftPanel.add(attackRngeLbl, c); c.gridx = 1; JTextField attackRnge = new JTextField(""); attackRnge.setColumns(20); leftPanel.add(attackRnge, c); c.gridx = 0; c.gridy = 7; JLabel movementLbl = new JLabel("Movement : "); leftPanel.add(movementLbl, c); c.gridx = 1; JTextField movement = new JTextField(""); movement.setColumns(20); leftPanel.add(movement, c); c.gridx = 0; c.gridy = 8; JLabel typeLbl = new JLabel("Type : "); leftPanel.add(typeLbl, c); c.gridx = 1; JTextField typeTxt = new JTextField(""); typeTxt.setColumns(20); leftPanel.add(typeTxt, c); c.gridx = 0; c.gridy = 9; JLabel weaponLbl = new JLabel("Equipped Weapon : "); leftPanel.add(weaponLbl, c); c.gridx = 1; DefaultComboBoxModel weapon = new DefaultComboBoxModel(); for (Item item : GameBean.weaponDetails) { if (item instanceof Weapon) { weapon.addElement(((Weapon) item).getName()); } } JComboBox weaponDrpDown = new JComboBox(weapon); weaponDrpDown.setSelectedIndex(-1); weaponDrpDown.setMaximumSize(new Dimension(100, 30)); leftPanel.add(weaponDrpDown, c); c.gridx = 0; c.gridy = 10; c.gridwidth = 2; JButton submit = new JButton("Save"); submit.addActionListener(this); submit.setActionCommand("button"); leftPanel.add(submit, c); wrapperPanel.add(leftPanel); lvlPanel = new LevelPanel(true, null); wrapperPanel.add(lvlPanel); c1.gridy = 2; c1.fill = GridBagConstraints.BOTH; add(wrapperPanel, c1); c1.fill = GridBagConstraints.NONE; validationMess = new JLabel("Pls enter all the fields or pls choose a character from the drop down"); validationMess.setForeground(Color.red); validationMess.setVisible(false); c1.gridy = 3; add(validationMess, c1); c1.weightx = 1; c1.fill = GridBagConstraints.BOTH; c1.weighty = 1; c1.gridy = 4; add(new JPanel(), c1); }
From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.AdvancedXY_PlotPanel.java
private void initChart(XY_PlotPanel pPanel) { this.plotPanel = pPanel; this.chartPanel = pPanel.getChartPanel(); if (pPanel instanceof SimpleXY_PlotPanel) { this.setTitle(((SimpleXY_PlotPanel) pPanel).getTitle()); }// ww w .j av a2s .c om JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); // how many data sets will there be (may not exist yet, cause swing worker may still be constructing them) int numRows = 2; // enough for counts, and delta counts if ((XY_PlotType.ADV_PORT_UTIL_PLUS.equals(getType()))) numRows = 4; boolean includeExtra = numRows > MAX_DATASETS / 2 ? true : false; int rowSize = includeExtra ? MAX_DS_SIZE : MAX_DS_SIZE / 2 + 19; // extra for padding NumDataSets = numRows; // build the table model from the data sets, then build the table and slider // see "chartProgress()" method chart.addProgressListener(this); this.chartPanel.setPreferredSize(new java.awt.Dimension(750, 300)); this.chartPanel.setDomainZoomable(true); this.chartPanel.setRangeZoomable(true); Border border = BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createEtchedBorder()); this.chartPanel.setBorder(border); add(this.chartPanel); JPanel dashboard = new JPanel(new BorderLayout()); dashboard.setPreferredSize(new Dimension(400, rowSize)); dashboard.setBorder(BorderFactory.createEmptyBorder(0, 4, 4, 4)); this.model = new XY_PlotTableModel(numRows); // initialize the model, and table, here // this.model.setValueAt("name", 0, 1); this.model.setValueAt(new Double("0.00"), 0, 1); this.model.setValueAt(new Double("0.00"), 0, 2); // this.model.setValueAt("units", 0, 3); JTable table = new JTable(this.model); // the columns are name, time, value, units. both name and units are strings // so need special renderers for time and value TableCellRenderer renderer1 = new DateCellRenderer(new SimpleDateFormat("HH:mm:ss")); TableCellRenderer renderer2 = new NumberCellRenderer(); table.getColumnModel().getColumn(1).setCellRenderer(renderer1); table.getColumnModel().getColumn(2).setCellRenderer(renderer2); JScrollPane scroller = new JScrollPane(table); dashboard.add(scroller); this.slider = new JSlider(0, 100, 10); this.slider.addChangeListener(this); dashboard.add(this.slider, BorderLayout.SOUTH); add(dashboard, BorderLayout.SOUTH); // XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainCrosshairLockedOnData(true); plot.setRangeCrosshairVisible(false); plot.setDomainCrosshairVisible(true); }
From source file:org.obiba.onyx.jade.instrument.summitdoppler.VantageABIInstrumentRunner.java
protected JPanel buildFileSelectionSubPanel() { final JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(Box.createVerticalGlue()); JButton openButton = new JButton(resourceBundle.getString("Select_file")); openButton.setMnemonic('O'); openButton.setToolTipText(resourceBundle.getString("ToolTip.Select_file")); panel.add(openButton);//from ww w . j ava 2s .c om panel.add(Box.createRigidArea(new Dimension(10, 10))); JLabel fileLabel = new ABIFileLabel(); panel.add(fileLabel); // Open button listener. openButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int returnVal = fileChooser.showOpenDialog(appWindow); if (returnVal == JFileChooser.APPROVE_OPTION) { abiFile = fileChooser.getSelectedFile(); panel.repaint(); saveButton.setEnabled(true); } } }); panel.setAlignmentX(Component.LEFT_ALIGNMENT); return panel; }