List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder(int top, int left, int bottom, int right)
From source file:org.rioproject.examples.hospital.ui.PatientStatsPanel.java
public PatientStatsPanel() { super(new BorderLayout(8, 8)); setBorder(BorderFactory.createEmptyBorder(2, 8, 8, 8)); patientLabel = new JLabel(getLabelText(null)); add(patientLabel, BorderLayout.NORTH); pulseTimeSeries.setMaximumItemAge(5 * MINUTE); temperatureTimeSeries.setMaximumItemAge(5 * MINUTE); TimeSeriesCollection pulseDataSet = new TimeSeriesCollection(pulseTimeSeries); TimeSeriesCollection temperatureDataSet = new TimeSeriesCollection(temperatureTimeSeries); JFreeChart pulseChart = createTimeSeriesChart(pulseDataSet, Color.RED); JFreeChart temperatureChart = createTimeSeriesChart(temperatureDataSet, Color.BLUE); JPanel chartPanel = new JPanel(new GridLayout(1, 2)); chartPanel.add(makeChartPanel(pulseChart)); chartPanel.add(makeChartPanel(temperatureChart)); add(chartPanel, BorderLayout.CENTER); scheduler = Executors.newSingleThreadScheduledExecutor(); scheduler.scheduleAtFixedRate(new FeederTask(), 0, 2, TimeUnit.SECONDS); }
From source file:gda.util.userOptions.UserOptionsDialog.java
/** * @param frame// ww w . j ava 2 s. c o m * @param parent * @param options */ public UserOptionsDialog(JFrame frame, Component parent, UserOptions options) { super(frame, options.title, true); this.frame = frame; this.options = options; JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); label = new JLabel(options.title != null ? options.title : ""); label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); label.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel pane = makePane(); // pane.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); pane.setAlignmentX(Component.CENTER_ALIGNMENT); // pane.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); panel.add(label); panel.add(pane); JPanel btnPanel = new JPanel(); btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.X_AXIS)); JButton okButton = new JButton("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); JButton defButton = new JButton("Default"); defButton.addActionListener(this); JButton resetButton = new JButton("Reset"); resetButton.addActionListener(this); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(okButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(cancelButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(defButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(resetButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.add(btnPanel); getContentPane().add(panel); getRootPane().setDefaultButton(cancelButton); pack(); setLocationRelativeTo(parent); setVisible(true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
From source file:jesse.GA_ANN.DataVis.java
JFreeChart createChart()//Here Input MillSecond { total = new XYSeries[10]; XYSeriescollection = new XYSeriesCollection(); for (int i = 0; i < 10; i++) { total[i] = new XYSeries(i); XYSeriescollection.addSeries(total[i]); }/*from w w w . j a va2 s .c om*/ dateaxis = new NumberAxis("Time"); NumberAxis Conaxis = new NumberAxis("z??"); dateaxis.setAutoRange(true); dateaxis.setLowerMargin(0.0D); dateaxis.setUpperMargin(0.0D); dateaxis.setTickLabelsVisible(true); xylineandshaperenderer = new XYLineAndShapeRenderer(true, false); xylineandshaperenderer.setSeriesPaint(0, Color.green); xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(1F, 0, 2)); xylineandshaperenderer.setFillPaint(new Color(30, 30, 220), true); Conaxis.setRange(-1, 1); Conaxis.setAutoRange(true); Conaxis.setAutoRangeIncludesZero(false); XYPlot xyplot = new XYPlot(XYSeriescollection, dateaxis, Conaxis, xylineandshaperenderer); JFreeChart jfreechart = new JFreeChart("time-z", new Font("Arial", 1, 24), xyplot, true); ChartUtilities.applyCurrentTheme(jfreechart); ChartPanel chartpanel = new ChartPanel(jfreechart, true); chartpanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); return jfreechart; }
From source file:layout.Find.java
public Find() { JLabel label = new JLabel("Find What:"); ;//from ww w .j ava 2 s .c o m JTextField textField = new JTextField(); JCheckBox caseCheckBox = new JCheckBox("Match Case"); JCheckBox wrapCheckBox = new JCheckBox("Wrap Around"); JCheckBox wholeCheckBox = new JCheckBox("Whole Words"); JCheckBox backCheckBox = new JCheckBox("Search Backwards"); JButton findButton = new JButton("Find"); JButton cancelButton = new JButton("Cancel"); // remove redundant default border of check boxes - they would hinder // correct spacing and aligning (maybe not needed on some look and feels) caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label) .addGroup(layout.createParallelGroup(LEADING).addComponent(textField) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(LEADING).addComponent(caseCheckBox) .addComponent(wholeCheckBox)) .addGroup(layout.createParallelGroup(LEADING).addComponent(wrapCheckBox) .addComponent(backCheckBox)))) .addGroup(layout.createParallelGroup(LEADING).addComponent(findButton).addComponent(cancelButton))); layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton); layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(label).addComponent(textField) .addComponent(findButton)) .addGroup(layout.createParallelGroup(LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(caseCheckBox) .addComponent(wrapCheckBox)) .addGroup(layout.createParallelGroup(BASELINE).addComponent(wholeCheckBox) .addComponent(backCheckBox))) .addComponent(cancelButton))); setTitle("Find"); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:GetApplets.java
private void createGUI() { JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK), BorderFactory.createEmptyBorder(10, 10, 10, 10))); setContentPane(contentPane);/* w w w . j ava 2 s .com*/ JButton b = new JButton("Click to call getApplets()"); b.addActionListener(this); add(b, BorderLayout.PAGE_START); textArea = new JTextArea(5, 40); textArea.setEditable(false); JScrollPane scroller = new JScrollPane(textArea); add(scroller, BorderLayout.CENTER); }
From source file:com.haulmont.cuba.desktop.sys.vcl.CollapsiblePanel.java
public CollapsiblePanel(JComponent composition) { this.composition = composition; titleBtn = new JButton(); titleBtn.setBorder(BorderFactory.createEmptyBorder(0, 3, 5, 3)); titleBtn.setVerticalTextPosition(AbstractButton.CENTER); titleBtn.setHorizontalTextPosition(AbstractButton.RIGHT); titleBtn.setMargin(new Insets(0, 0, 3, 0)); titleBtn.setFont(getTitleFont());//from w ww. ja v a 2 s . c o m titleBtn.setFocusable(false); titleBtn.setContentAreaFilled(false); titleBtn.setVisible(false); titleBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isCollapsable()) setExpanded(!isExpanded()); } }); // Add icons loadIcons(); refreshTitleIcon(); setLayout(new BorderLayout()); add(titleBtn, BorderLayout.CENTER); add(composition, BorderLayout.CENTER); setBorder(createBorderImplementation()); preferredSize = getPreferredSize(); placeTitleComponent(); }
From source file:com.stefanbrenner.droplet.ui.AddDeviceDialog.java
public AddDeviceDialog(final JFrame frame, final IDropletContext dropletContext) { super(frame, dropletContext, Messages.getString("AddDeviceDialog.title")); //$NON-NLS-1$ droplet = dropletContext.getDroplet(); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.setLayout(new GridLayout(1, 0, 7, 7)); btnValve = new JButton(Messages.getString("AddDeviceDialog.valve")); //$NON-NLS-1$ btnValve.addActionListener(this); panel.add(btnValve);//from www. j ava 2s .c o m btnFlash = new JButton(Messages.getString("AddDeviceDialog.flash")); //$NON-NLS-1$ btnFlash.addActionListener(this); panel.add(btnFlash); btnCamera = new JButton(Messages.getString("AddDeviceDialog.camera")); //$NON-NLS-1$ btnCamera.addActionListener(this); panel.add(btnCamera); btnButton = new JButton(Messages.getString("AddDeviceDialog.button")); //$NON-NLS-1$ btnButton.addActionListener(this); panel.add(btnButton); btnClose = new JButton(Messages.getString("AddDeviceDialog.close")); //$NON-NLS-1$ btnClose.addActionListener(this); panel.add(btnClose); add(panel); setAlwaysOnTop(true); setResizable(false); pack(); setLocationRelativeTo(frame); droplet.addPropertyChangeListener(IDroplet.ASSOCIATION_DEVICES, new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { updateComponents(); } }); updateComponents(); }
From source file:lookandfeel.SynthDialog.java
public SynthDialog() { JLabel label = new JLabel("Find What:"); ;/*from ww w .j a v a 2s .c o m*/ JTextField textField = new JTextField(); JCheckBox caseCheckBox = new JCheckBox("Match Case"); JCheckBox wrapCheckBox = new JCheckBox("Wrap Around"); JCheckBox wholeCheckBox = new JCheckBox("Whole Words"); JCheckBox backCheckBox = new JCheckBox("Search Backwards"); JButton findButton = new JButton("Find"); JButton cancelButton = new JButton("Cancel"); // remove redundant default border of check boxes - they would hinder // correct spacing and aligning (maybe not needed on some look and feels) caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label) .addGroup(layout.createParallelGroup(LEADING).addComponent(textField) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(LEADING).addComponent(caseCheckBox) .addComponent(wholeCheckBox)) .addGroup(layout.createParallelGroup(LEADING).addComponent(wrapCheckBox) .addComponent(backCheckBox)))) .addGroup(layout.createParallelGroup(LEADING).addComponent(findButton).addComponent(cancelButton))); layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton); layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(label).addComponent(textField) .addComponent(findButton)) .addGroup(layout.createParallelGroup(LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(BASELINE).addComponent(caseCheckBox) .addComponent(wrapCheckBox)) .addGroup(layout.createParallelGroup(BASELINE).addComponent(wholeCheckBox) .addComponent(backCheckBox))) .addComponent(cancelButton))); setTitle("Find"); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); }
From source file:be.ac.ua.comp.scarletnebula.gui.TaggingPanel.java
public TaggingPanel(final Collection<String> initialTags) { super(new BorderLayout()); for (final String tag : initialTags) { taglist.addTag(new TagItem(tag)); }// w w w .j a v a2 s .c o m final BetterTextField inputField = new BetterTextField(); addTagActionListener = new AddTagActionListener(inputField); inputField.addActionListener(addTagActionListener); final String hint = "Type a tag and press enter"; inputField.setPlaceHolder(hint); inputField.setToolTipText(hint); inputField.setInputVerifier(new TagInputVerifier(inputField)); inputField.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0), BorderFactory.createBevelBorder(BevelBorder.LOWERED))); taglist.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); final JScrollPane tagScrollPane = new JScrollPane(taglist); tagScrollPane.setBorder(null); final JPanel centerPanel = new JPanel(new BorderLayout()); centerPanel.add(inputField, BorderLayout.NORTH); centerPanel.add(tagScrollPane, BorderLayout.CENTER); centerPanel.setMaximumSize(new Dimension(250, 500)); centerPanel.setPreferredSize(new Dimension(200, 200)); setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(Box.createHorizontalGlue()); add(centerPanel); add(Box.createHorizontalGlue()); }
From source file:com.choicemaker.cm.modelmaker.gui.panels.StatisticsHistogramPanel.java
public StatisticsHistogramPanel(TestingControlPanel g) { super(); parent = g; setBorder(BorderFactory.createEmptyBorder(15, 5, 5, 5)); buildPanel(); addListeners(); layoutPanel(); }