List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder(int top, int left, int bottom, int right)
From source file:edu.ku.brc.specify.ui.SelectPrepsDlg.java
@Override public void createUI() { applyLabel = getResourceString("SELECTALL");//$NON-NLS-1$ super.createUI(); Vector<ColObjInfo> coList = new Vector<ColObjInfo>(coToPrepHash.values()); Collections.sort(coList, new Comparator<ColObjInfo>() { @Override/*from w ww . j av a 2 s. c o m*/ public int compare(ColObjInfo o1, ColObjInfo o2) { return o1.getCatNo().compareTo(o2.getCatNo()); } }); int cnt = 0; Vector<ColObjInfo> coFilteredList = new Vector<ColObjInfo>(); for (ColObjInfo colObjInfo : coList) { if (StringUtils.isNotEmpty(colObjInfo.getCatNo()) && colObjInfo.getPreps() != null && colObjInfo.getPreps().size() > 0) { coFilteredList.add(colObjInfo); cnt += colObjInfo.getPreps().size(); } } String rowDef = UIHelper.createDuplicateJGoodiesDef("p", "1px,p,4px", (cnt * 2) - 1) + ",10px,p"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ PanelBuilder pbuilder = new PanelBuilder(new FormLayout("f:p:g", rowDef)); //$NON-NLS-1$ CellConstraints cc = new CellConstraints(); ActionListener al = new ActionListener() { public void actionPerformed(ActionEvent ae) { doEnableOKBtn(); } }; ChangeListener cl = new ChangeListener() { public void stateChanged(ChangeEvent ae) { doEnableOKBtn(); } }; DBTableInfo colObjTI = DBTableIdMgr.getInstance().getInfoById(CollectionObject.getClassTableId()); DBFieldInfo colObjFI = colObjTI.getFieldByColumnName("CatalogNumber"); int i = 0; int y = 1; for (ColObjInfo colObjInfo : coFilteredList) { if (i > 0) { pbuilder.addSeparator("", cc.xy(1, y)); //$NON-NLS-1$ } y += 2; colObjInfo.setCatNo((String) colObjFI.getFormatter().formatToUI(colObjInfo.getCatNo())); ColObjPanel panel = new ColObjPanel(this, colObjInfo); colObjPanels.add(panel); panel.addActionListener(al, cl); pbuilder.add(panel, cc.xy(1, y)); y += 2; i++; } applyBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { selectAllItems(); } }); JPanel tPanel = new JPanel(new BorderLayout()); summaryLabel = createLabel(""); //$NON-NLS-1$ tPanel.setBorder(BorderFactory.createEmptyBorder(5, 1, 5, 1)); tPanel.add(summaryLabel, BorderLayout.NORTH); JScrollPane sp = new JScrollPane(pbuilder.getPanel(), ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); tPanel.add(sp, BorderLayout.CENTER); contentPanel = tPanel; mainPanel.add(contentPanel, BorderLayout.CENTER); pack(); doEnableOKBtn(); Dimension size = getPreferredSize(); size.width += 20; size.height = size.height > 500 ? 500 : size.height; setSize(size); }
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()); }//from w ww . ja v a 2 s. 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:FrameDemo2.java
protected JComponent createButtonPane() { JButton button = new JButton("New window"); button.setActionCommand(CREATE_WINDOW); button.addActionListener(this); defaultButton = button; // Used later to make this the frame's default // button. // Center the button in a panel with some space around it. JPanel pane = new JPanel(); // use default FlowLayout pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); pane.add(button);// www . j a v a2 s .c o m return pane; }
From source file:com.mirth.connect.manager.ManagerDialog.java
private void initServerPanel() { serverPanel = new JPanel( new MigLayout("insets 8, novisualpadding, hidemode 3, fill", "[right][left][right][left]")); serverPanel.setFocusable(false);/*from w ww .j av a 2 s . c om*/ serverPanel.setBackground(new Color(255, 255, 255)); serverPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); webstartPortLabel = new JLabel("Web Start Port:"); webstartPortField = new MirthTextField(); adminPortLabel = new JLabel("Administrator Port:"); adminPortField = new MirthTextField(); serverMemoryLabel = new JLabel("Server Memory (mb):"); serverMemoryField = new MirthTextField(); serverLogFiles = new JList(); serverLogFiles.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { serverLogFilesValueChanged(evt); } }); serverLogFiles.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent evt) { } public void mouseReleased(MouseEvent evt) { } public void mouseClicked(MouseEvent evt) { if (evt.getClickCount() >= 2) { if (serverLogFiles.getSelectedIndex() != -1) { viewFileButtonActionPerformed(null); } } } }); serverLogsScrollPane = new JScrollPane(); serverLogsScrollPane.setViewportView(serverLogFiles); mainLogLevelLabel = new JLabel("Main Log Level:"); mainLogLevelCombobox = new MirthComboBox(); mainLogLevelCombobox.setModel(new DefaultComboBoxModel(ManagerConstants.LOG4J_ERROR_CODES)); // This can be combined with the above as a new ctor databaseLogLevelLabel = new JLabel("Database Log Level:"); databaseLogLevelCombobox = new MirthComboBox(); databaseLogLevelCombobox.setModel(new DefaultComboBoxModel(ManagerConstants.LOG4J_ERROR_CODES)); channelLogLevelLabel = new JLabel("Channel Log Level:"); channelLogLevelCombobox = new MirthComboBox(); channelLogLevelCombobox.setModel(new DefaultComboBoxModel(ManagerConstants.LOG4J_ERROR_CODES_WITH_BLANK)); refreshServiceButton = new JButton("Refresh"); refreshServiceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { refreshServiceButtonActionPerformed(evt); } }); viewFileButton = new JButton("View File"); viewFileButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { viewFileButtonActionPerformed(evt); } }); }
From source file:com.gdc.nms.web.mibquery.wizard.ciscavate.cjwizard.WizardContainer.java
/** * //w ww.j av a 2 s .co m */ private void initComponents() { final JButton prevBtn = new JButton(_prevAction); final JButton nextBtn = new JButton(_nextAction); final JButton finishBtn = new JButton(_finishAction); final JButton cancelBtn = new JButton(_cancelAction); _extraButtonPanel = new JPanel(); _extraButtonPanel.setLayout(new BoxLayout(_extraButtonPanel, BoxLayout.LINE_AXIS)); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.add(_extraButtonPanel); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(prevBtn); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(nextBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(finishBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(cancelBtn); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15)); //this.setLayout(new BorderLayout()); //this.add(_template, BorderLayout.CENTER); //this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:net.schweerelos.parrot.ui.GraphViewComponent.java
public GraphViewComponent() { super();/*from w w w. j av a2 s . c o m*/ setLayout(new GridBagLayout()); setBorder( BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(PADDING_NODE_BORDER, PADDING_NODE_BORDER, PADDING_NODE_BORDER, PADDING_NODE_BORDER), BorderFactory.createLoweredBevelBorder())); layout = new NodeWrapperPersistentLayoutImpl(new CircleLayout<NodeWrapper, NodeWrapper>( new DirectedSparseMultigraph<NodeWrapper, NodeWrapper>())); vv = new VisualizationViewer<NodeWrapper, NodeWrapper>(layout); setupRenderContext(vv); view = new JScrollPane(vv); add(view, CONTENT_CONSTRAINTS); }
From source file:com.github.cjwizard.WizardContainer.java
/** * /*from www.ja v a2 s.c o m*/ */ private void initComponents() { final JButton prevBtn = new JButton(_prevAction); final JButton nextBtn = new JButton(_nextAction); final JButton finishBtn = new JButton(_finishAction); final JButton cancelBtn = new JButton(_cancelAction); _extraButtonPanel = new JPanel(); _extraButtonPanel.setLayout(new BoxLayout(_extraButtonPanel, BoxLayout.LINE_AXIS)); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.add(_extraButtonPanel); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(prevBtn); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(nextBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(finishBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(cancelBtn); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15)); this.setLayout(new BorderLayout()); this.add(_template, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java
private void refreshQuickOpenPanel(JPanel panel, List<Action> quickOpenActionList, List<File> fileList) { panel.removeAll();// w w w. jav a 2 s . c om quickOpenActionList.clear(); if (fileList.isEmpty()) { JLabel noneLabel = new JLabel("None"); noneLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); panel.add(noneLabel); } else { for (File file : fileList) { Action quickOpenAction = new QuickOpenAction(file); quickOpenActionList.add(quickOpenAction); JButton quickOpenButton = new JButton(quickOpenAction); quickOpenButton.setHorizontalAlignment(SwingConstants.LEFT); quickOpenButton.setMargin(new Insets(0, 0, 0, 0)); panel.add(quickOpenButton); } } }
From source file:WizardDialog.java
/** * Creates a panel containing the user interface for the dialog. * /* w w w .j a v a 2 s .c o m*/ * @return the panel. */ public JPanel createContent() { final JPanel content = new JPanel(new BorderLayout()); content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); content.add((JPanel) this.panels.get(0)); final L1R3ButtonPanel buttons = new L1R3ButtonPanel("Help", "Previous", "Next", "Finish"); this.helpButton = buttons.getLeftButton(); this.helpButton.setEnabled(false); this.previousButton = buttons.getRightButton1(); this.previousButton.setActionCommand("previousButton"); this.previousButton.addActionListener(this); this.previousButton.setEnabled(false); this.nextButton = buttons.getRightButton2(); this.nextButton.setActionCommand("nextButton"); this.nextButton.addActionListener(this); this.nextButton.setEnabled(true); this.finishButton = buttons.getRightButton3(); this.finishButton.setActionCommand("finishButton"); this.finishButton.addActionListener(this); this.finishButton.setEnabled(false); buttons.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); content.add(buttons, BorderLayout.SOUTH); return content; }
From source file:com.haskins.cloudtrailviewer.feature.MetricsFeature.java
private void buildUI() { // toolbar/*from w w w .j a v a 2 s. com*/ toolbar.setLayout(new WrapLayout(FlowLayout.CENTER, 1, 1)); toolbar.setFloatable(false); toolbar.setBackground(Color.white); toolbar.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Color.black)); eventTable.setVisible(false); jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, chartCards, eventTable); jsp.setDividerSize(0); jsp.setResizeWeight(1); jsp.setDividerLocation(jsp.getSize().height - jsp.getInsets().bottom - jsp.getDividerSize()); jsp.setBorder(BorderFactory.createEmptyBorder(1, 0, 0, 0)); this.setLayout(new BorderLayout()); this.add(toolbar, BorderLayout.PAGE_START); this.add(jsp, BorderLayout.CENTER); }