List of usage examples for javax.swing BorderFactory createLineBorder
public static Border createLineBorder(Color color)
From source file:org.pentaho.ui.xul.swing.tags.SwingListbox.java
public SwingListbox(Element self, XulComponent parent, XulDomContainer container, String tagName) { super(tagName); model = new DefaultListModel(); listBox = new JList(model); scrollPane = new JScrollPane(listBox); listBox.setBorder(BorderFactory.createLineBorder(Color.gray)); listBox.addListSelectionListener(this); setManagedObject(scrollPane);/*from w w w . java2 s . c o m*/ this.xulDomContainer = container; Dimension size = scrollPane.getPreferredSize(); scrollPane.setMinimumSize(size); }
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 www. j a va 2s.c o m*/ 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:layout.BoxLayoutDemo2.java
public void populateContentPane(Container contentPane) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); //Create the rectangles. int shortSideSize = 15; for (int i = 0; i < NUM_COMPONENTS; i++) { if (sizeIsRandom) { shortSideSize = (int) (30.0 * Math.random()) + 30; } else {//from w w w.j a v a 2s.c o m shortSideSize += 10; } bldComponent[i] = new BLDComponent(xAlignment[i], hue[i], shortSideSize, restrictSize, sizeIsRandom, String.valueOf(i)); panel.add(bldComponent[i]); } //Create the instructions. JLabel label = new JLabel("Click a rectangle to " + "change its X alignment."); JCheckBox cb = new JCheckBox("Restrict maximum rectangle size."); cb.setSelected(restrictSize); cb.addItemListener(this); panel.setBorder(BorderFactory.createLineBorder(Color.red)); Box box = Box.createVerticalBox(); box.add(label); box.add(cb); contentPane.add(panel, BorderLayout.CENTER); contentPane.add(box, BorderLayout.PAGE_END); }
From source file:org.jdal.swing.form.SimpleBoxFormBuilder.java
/** * Add a component to Form at position pointer by cursor, * Increments cursor by one.//from ww w . j ava2s . c o m * @param c Component to add */ public void add(Component c) { if (debug) { if (c instanceof JComponent) ((JComponent) c).setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY)); } addBox(c); if (rowHeight < Short.MAX_VALUE) { Dimension d = c.getPreferredSize(); d.height = rowHeight; c.setPreferredSize(d); c.setMinimumSize(d); if (!c.isMaximumSizeSet() || c.getMaximumSize().getHeight() > rowHeight) { c.setMaximumSize(new Dimension(Short.MAX_VALUE, rowHeight)); } } }
From source file: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);// w w w . ja va2 s .co m 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:components.CrayonPanel.java
protected JToggleButton createCrayon(String name, Border normalBorder) { JToggleButton crayon = new JToggleButton(); crayon.setActionCommand(name);/* w w w .j a va 2 s . com*/ crayon.addActionListener(this); //Set the image or, if that's invalid, equivalent text. ImageIcon icon = createImageIcon("images/" + name + ".gif"); if (icon != null) { crayon.setIcon(icon); crayon.setToolTipText("The " + name + " crayon"); crayon.setBorder(normalBorder); } else { crayon.setText("Image not found. This is the " + name + " button."); crayon.setFont(crayon.getFont().deriveFont(Font.ITALIC)); crayon.setHorizontalAlignment(JButton.HORIZONTAL); crayon.setBorder(BorderFactory.createLineBorder(Color.BLACK)); } return crayon; }
From source file:unusedClasses.MemoryUsageDemo.java
public MemoryUsageDemo(int paramInt) { super(new BorderLayout()); this.total.setMaximumItemAge(paramInt); this.free = new TimeSeries("Free Memory"); this.free.setMaximumItemAge(paramInt); TimeSeriesCollection localTimeSeriesCollection = new TimeSeriesCollection(); localTimeSeriesCollection.addSeries(this.total); localTimeSeriesCollection.addSeries(this.free); DateAxis localDateAxis = new DateAxis("Time"); NumberAxis localNumberAxis = new NumberAxis("Memory"); localDateAxis.setTickLabelFont(new Font("SansSerif", 0, 12)); localNumberAxis.setTickLabelFont(new Font("SansSerif", 0, 12)); localDateAxis.setLabelFont(new Font("SansSerif", 0, 14)); localNumberAxis.setLabelFont(new Font("SansSerif", 0, 14)); XYLineAndShapeRenderer localXYLineAndShapeRenderer = new XYLineAndShapeRenderer(true, false); localXYLineAndShapeRenderer.setSeriesPaint(0, Color.red); localXYLineAndShapeRenderer.setSeriesPaint(1, Color.green); localXYLineAndShapeRenderer.setSeriesStroke(0, new BasicStroke(3.0F, 0, 2)); localXYLineAndShapeRenderer.setSeriesStroke(1, new BasicStroke(3.0F, 0, 2)); XYPlot localXYPlot = new XYPlot(localTimeSeriesCollection, localDateAxis, localNumberAxis, localXYLineAndShapeRenderer); localDateAxis.setAutoRange(true);//from w ww.j av a2 s.c om localDateAxis.setLowerMargin(0.0D); localDateAxis.setUpperMargin(0.0D); localDateAxis.setTickLabelsVisible(true); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFreeChart localJFreeChart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", 1, 24), localXYPlot, true); ChartUtilities.applyCurrentTheme(localJFreeChart); ChartPanel localChartPanel = new ChartPanel(localJFreeChart, true); localChartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); add(localChartPanel); }
From source file:components.ScrollDemo.java
public ScrollDemo() { setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); //Get the image to use. ImageIcon bee = createImageIcon("images/flyingBee.jpg"); //Create the row and column headers. columnView = new Rule(Rule.HORIZONTAL, true); rowView = new Rule(Rule.VERTICAL, true); if (bee != null) { columnView.setPreferredWidth(bee.getIconWidth()); rowView.setPreferredHeight(bee.getIconHeight()); } else {/*from ww w .j av a2 s. c o m*/ columnView.setPreferredWidth(320); rowView.setPreferredHeight(480); } //Create the corners. JPanel buttonCorner = new JPanel(); //use FlowLayout isMetric = new JToggleButton("cm", true); isMetric.setFont(new Font("SansSerif", Font.PLAIN, 11)); isMetric.setMargin(new Insets(2, 2, 2, 2)); isMetric.addItemListener(this); buttonCorner.add(isMetric); //Set up the scroll pane. picture = new ScrollablePicture(bee, columnView.getIncrement()); JScrollPane pictureScrollPane = new JScrollPane(picture); pictureScrollPane.setPreferredSize(new Dimension(300, 250)); pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black)); pictureScrollPane.setColumnHeaderView(columnView); pictureScrollPane.setRowHeaderView(rowView); //Set the corners. //In theory, to support internationalization you would change //UPPER_LEFT_CORNER to UPPER_LEADING_CORNER, //LOWER_LEFT_CORNER to LOWER_LEADING_CORNER, and //UPPER_RIGHT_CORNER to UPPER_TRAILING_CORNER. In practice, //bug #4467063 makes that impossible (in 1.4, at least). pictureScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, buttonCorner); pictureScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, new Corner()); pictureScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new Corner()); //Put it in this panel. add(pictureScrollPane); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:volker.streaming.music.gui.ConfigPanel.java
private void initComponents() { userLabel = new JLabel("Last.fm user name:"); userField = new JTextField(config.getUser(), 15); userField.getDocument().addDocumentListener(configUpdater); pollLabel = new JLabel("Update track info every"); pollField = new JTextField(3); pollField.setText(String.valueOf(config.getPollInterval())); pollField.getDocument().addDocumentListener(configUpdater); pollField.getDocument().addDocumentListener(numberValidator); pollEndLabel = new JLabel("seconds"); pollErrorLabel = new JLabel("Poll interval should be a valid integer."); pollErrorLabel.setForeground(Color.RED); pollBorder = pollField.getBorder();/* w ww.j a v a2s . c o m*/ pollErrorBorder = BorderFactory.createLineBorder(Color.RED); pollErrorLabel.setVisible(false); apiSchemeLabel = new JLabel("Last.fm API scheme:"); apiSchemeField = new JTextField(config.getApiScheme()); apiSchemeField.getDocument().addDocumentListener(configUpdater); apiBaseLabel = new JLabel("Last.fm API base URL:"); apiBaseField = new JTextField(config.getApiBase()); apiBaseField.getDocument().addDocumentListener(configUpdater); apiPathLabel = new JLabel("Last.fm API path URL:"); apiPathField = new JTextField(config.getApiPath()); apiPathField.getDocument().addDocumentListener(configUpdater); apiKeyLabel = new JLabel("Last.fm API key:"); apiKeyField = new JTextField(config.getApiKey()); apiKeyField.getDocument().addDocumentListener(configUpdater); advancedViewBox = new JCheckBox("Display advanced configuration options", advancedView); advancedViewBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { advancedViewBoxListener(e); } }); }
From source file:org.openconcerto.erp.graph.GraphFamilleArticlePanel.java
private Component createColorPanel(final Color color) { final JPanel p = new JPanel(); p.setBorder(BorderFactory.createLineBorder(Color.WHITE)); p.setMinimumSize(new Dimension(40, 16)); p.setPreferredSize(new Dimension(40, 16)); p.setOpaque(true);/*from w w w.j a v a 2 s . c o m*/ p.setBackground(color); return p; }