List of usage examples for javax.swing BorderFactory createCompoundBorder
public static CompoundBorder createCompoundBorder(Border outsideBorder, Border insideBorder)
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)); }//from w w w . j a v a 2 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:org.apache.taverna.activities.xpath.ui.config.XPathActivityConfigurationPanelProvider.java
@Override protected void initialise() { super.initialise(); removeAll();//from w ww . j ava 2 s.c o m setLayout(new BorderLayout()); // create actual contents of the config panel this.configPanel = new XPathActivityConfigurationPanel(); add(configPanel, BorderLayout.CENTER); // place the whole configuration panel into a raised area, so that // automatically added 'Apply' / 'Close' buttons visually apply to // the whole of the panel, not just part of it this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(12, 12, 2, 12), BorderFactory.createRaisedBevelBorder())); // Populate fields from activity configuration bean refreshConfiguration(); }
From source file:org.jfree.chart.demo.selection.SelectionDemo6Pie.java
public SelectionDemo6Pie(String title) { super(title); JPanel chartPanel = createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(700, 500)); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel);/* www. j a v a2 s.c om*/ this.model = new DefaultTableModel(new String[] { "section", "value:" }, 0); this.table = new JTable(this.model); TableColumnModel tcm = this.table.getColumnModel(); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
From source file:components.ConversionPanel.java
ConversionPanel(Converter myController, String myTitle, Unit[] myUnits, ConverterRangeModel myModel) { if (MULTICOLORED) { setOpaque(true);/* w w w .jav a2s.c o m*/ setBackground(new Color(0, 255, 255)); } setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(myTitle), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Save arguments in instance variables. controller = myController; units = myUnits; title = myTitle; sliderModel = myModel; //Create the text field format, and then the text field. numberFormat = NumberFormat.getNumberInstance(); numberFormat.setMaximumFractionDigits(2); NumberFormatter formatter = new NumberFormatter(numberFormat); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true);//seems to be a no-op -- //aha -- it changes the value property but doesn't cause the result to //be parsed (that happens on focus loss/return, I think). // textField = new JFormattedTextField(formatter); textField.setColumns(10); textField.setValue(new Double(sliderModel.getDoubleValue())); textField.addPropertyChangeListener(this); //Add the combo box. unitChooser = new JComboBox(); for (int i = 0; i < units.length; i++) { //Populate it. unitChooser.addItem(units[i].description); } unitChooser.setSelectedIndex(0); sliderModel.setMultiplier(units[0].multiplier); unitChooser.addActionListener(this); //Add the slider. slider = new JSlider(sliderModel); sliderModel.addChangeListener(this); //Make the text field/slider group a fixed size //to make stacked ConversionPanels nicely aligned. JPanel unitGroup = new JPanel() { public Dimension getMinimumSize() { return getPreferredSize(); } public Dimension getPreferredSize() { return new Dimension(150, super.getPreferredSize().height); } public Dimension getMaximumSize() { return getPreferredSize(); } }; unitGroup.setLayout(new BoxLayout(unitGroup, BoxLayout.PAGE_AXIS)); if (MULTICOLORED) { unitGroup.setOpaque(true); unitGroup.setBackground(new Color(0, 0, 255)); } unitGroup.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); unitGroup.add(textField); unitGroup.add(slider); //Create a subpanel so the combo box isn't too tall //and is sufficiently wide. JPanel chooserPanel = new JPanel(); chooserPanel.setLayout(new BoxLayout(chooserPanel, BoxLayout.PAGE_AXIS)); if (MULTICOLORED) { chooserPanel.setOpaque(true); chooserPanel.setBackground(new Color(255, 0, 255)); } chooserPanel.add(unitChooser); chooserPanel.add(Box.createHorizontalStrut(100)); //Put everything together. setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(unitGroup); add(chooserPanel); unitGroup.setAlignmentY(TOP_ALIGNMENT); chooserPanel.setAlignmentY(TOP_ALIGNMENT); }
From source file:com.tencent.wstt.apt.chart.AbstractRealTimeLineChart.java
/** * ?jfreechatpanel/*from w ww . ja v a 2s .c o m*/ */ public AbstractRealTimeLineChart() { super(new BorderLayout()); chart = createChart(); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); this.add(chartPanel); }
From source file:org.jfree.chart.demo.selection.SelectionDemo8.java
/** * A demonstration application showing how to create a simple time series * chart. This example uses monthly data. * * @param title the frame title.// w w w.jav a 2 s .c o m */ public SelectionDemo8(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); chartPanel.setRangeZoomable(false); JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); this.dataset = (TimeSeriesCollection) plot.getDataset(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel); this.model = new DefaultTableModel(new String[] { "Series:", "Item:", "Period:", "Value:" }, 0); this.table = new JTable(this.model); TableColumnModel tcm = this.table.getColumnModel(); tcm.getColumn(3).setCellRenderer(new NumberCellRenderer()); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
From source file:components.ComboBoxDemo2.java
public ComboBoxDemo2() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z", "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" }; currentPattern = patternExamples[0]; //Set up the UI for selecting a pattern. JLabel patternLabel1 = new JLabel("Enter the pattern string or"); JLabel patternLabel2 = new JLabel("select one from the list:"); JComboBox patternList = new JComboBox(patternExamples); patternList.setEditable(true);/*from w w w .jav a2 s . c om*/ patternList.addActionListener(this); //Create the UI for displaying result. JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); //== LEFT result = new JLabel(" "); result.setForeground(Color.black); result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Lay out everything. JPanel patternPanel = new JPanel(); patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS)); patternPanel.add(patternLabel1); patternPanel.add(patternLabel2); patternList.setAlignmentX(Component.LEFT_ALIGNMENT); patternPanel.add(patternList); JPanel resultPanel = new JPanel(new GridLayout(0, 1)); resultPanel.add(resultLabel); resultPanel.add(result); patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT); resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(patternPanel); add(Box.createRigidArea(new Dimension(0, 10))); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); reformat(); }
From source file:org.jfree.chart.demo.selection.SelectionDemo5Category.java
public SelectionDemo5Category(String title) { super(title); JPanel chartPanel = createDemoPanel(); chartPanel.setPreferredSize(new Dimension(500, 270)); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel);/*from w w w . j a v a2 s. c o m*/ this.model = new DefaultTableModel(new String[] { "row:", "column:", "value:" }, 0); this.table = new JTable(this.model); TableColumnModel tcm = this.table.getColumnModel(); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
From source file:org.jfree.chart.demo.selection.SelectionDemo4.java
/** * Creates a new demo./*from w w w.j av a 2s. c o m*/ * * @param title the frame title. */ public SelectionDemo4(String title) { super(title); ChartPanel chartPanel = (ChartPanel) createDemoPanel(); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); JFreeChart chart = chartPanel.getChart(); XYPlot plot = (XYPlot) chart.getPlot(); this.dataset = (HistogramDataset) plot.getDataset(); JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); split.add(chartPanel); this.model = new DefaultTableModel(new String[] { "Item:", "Bin Start:", "Bin End:", "Value:" }, 0); this.table = new JTable(this.model); JPanel p = new JPanel(new BorderLayout()); JScrollPane scroller = new JScrollPane(this.table); p.add(scroller); p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "), new EmptyBorder(4, 4, 4, 4))); split.add(p); setContentPane(split); }
From source file:org.esa.beam.timeseries.ui.graph.TimeSeriesGraphForm.java
private void createUI(JFreeChart chart, String helpID) { final TableLayout tableLayout = new TableLayout(2); tableLayout.setTablePadding(4, 4);//w w w.j a va 2 s .c o m tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayout.setTableFill(TableLayout.Fill.BOTH); tableLayout.setTableWeightY(1.0); tableLayout.setColumnWeightX(0, 1.0); tableLayout.setColumnWeightX(1, 0.0); tableLayout.setRowWeightY(0, 1.0); tableLayout.setRowWeightY(1, 0.0); tableLayout.setCellRowspan(0, 1, 2); tableLayout.setCellFill(1, 0, TableLayout.Fill.HORIZONTAL); tableLayout.setCellPadding(1, 0, new Insets(5, 5, 5, 5)); mainPanel = new JPanel(tableLayout); mainPanel.setPreferredSize(new Dimension(320, 200)); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2))); mainPanel.add(chartPanel); mainPanel.add(createButtonPanel(helpID)); mainPanel.add(validatorUI.createUI()); }