List of usage examples for javax.swing BorderFactory createLineBorder
public static Border createLineBorder(Color color)
From source file:TreeNodeVector.java
public EmployeeCellRenderer() { firstNameLabel.setForeground(Color.BLUE); renderer.add(firstNameLabel);//w ww . j a v a 2 s . c o m lastNameLabel.setForeground(Color.BLUE); renderer.add(lastNameLabel); salaryLabel.setHorizontalAlignment(JLabel.RIGHT); salaryLabel.setForeground(Color.RED); renderer.add(salaryLabel); renderer.setBorder(BorderFactory.createLineBorder(Color.BLACK)); backgroundSelectionColor = defaultRenderer.getBackgroundSelectionColor(); backgroundNonSelectionColor = defaultRenderer.getBackgroundNonSelectionColor(); }
From source file:lu.lippmann.cdb.common.gui.MultiPanel.java
/** * Constructor.//w w w.j av a 2 s.co m */ public MultiPanel(final ListOrderedMap<JComponent, Integer> mapPanels, final int w, final int h, final boolean withWeight) { final int total = mapPanels.keySet().size(); if (!withWeight) setLayout(new GridLayout(0, 1)); final int w2 = w - 10 * total; final int h2 = h - 75; final Map<JComponent, Color> choosedColor = new HashMap<JComponent, Color>(); int i = 0; for (final JComponent p : mapPanels.keySet()) { final Dimension size = new Dimension((int) (w2 * (mapPanels.get(p) / 100.0)), h2); p.setPreferredSize(size); choosedColor.put(p, COLORS[i]); p.setBackground(COLORS[i]); p.setBorder(BorderFactory.createLineBorder(Color.BLACK)); add(p); i++; } if (withWeight) { /** add percents **/ for (final JComponent p : mapPanels.keySet()) { final int perc = mapPanels.get(p); final int percent = (int) (w2 * (mapPanels.get(p) / 100.0)); final Dimension size = new Dimension(percent, 20); final JPanel arrow = new JPanel(); arrow.setPreferredSize(size); final JLabel label = new JLabel(perc + "%"); label.setForeground(choosedColor.get(p).darker()); arrow.add(label); add(arrow); } } }
From source file:edu.virginia.speclab.juxta.author.view.DocumentSourceCard.java
public void setEditable(boolean editable) { this.dsTextArea.setEditable(editable); if (editable) { this.textScroller.setBorder(BorderFactory.createLineBorder(Color.RED)); } else {//from w w w. ja va2 s . c o m this.textScroller.setBorder(null); } }
From source file:Commander.Main.java
/** * Creates new form Main//from www .j av a 2s.c om */ public Main(java.awt.Frame parent, boolean modal) { super(parent, modal); //Set tranparant Color transparant = new Color(0, 0, 0, 0); setUndecorated(true); getRootPane().setOpaque(false); getContentPane().setBackground(transparant); setBackground(transparant); initComponents(); //Set components transparant transparant = new Color(0, 0, 0, 1); txtCommand.setBackground(transparant); txtCommand.setForeground(Color.GREEN); txtCommand.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0, 150))); jScrollPane1.getViewport().setBackground(transparant); jScrollPane1.getViewport().setOpaque(false); txtError.setBackground(transparant); txtError.setForeground(Color.RED); txtError.setEditable(false); txtError.setFocusable(false); jScrollPane1.setVisible(false); setAlwaysOnTop(true); pack(); Rectangle screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds(); int width = getPreferredSize().width; int height = getPreferredSize().height; setLocation(screen.width - width - 20, screen.height - height - 20); txtCommand.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { if (jScrollPane1.isVisible()) { jScrollPane1.setVisible(false); } } @Override public void removeUpdate(DocumentEvent e) { if (jScrollPane1.isVisible()) { jScrollPane1.setVisible(false); } } @Override public void changedUpdate(DocumentEvent e) { //Not supported } }); String home = System.getProperty("user.home"); defaultLocations[0] = home + "/Documents"; defaultLocations[1] = home + "/Pictures"; defaultLocations[2] = home + "/Downloads"; defaultLocations[3] = home + "/Music"; // run("Casino.jar", new ArrayList<>()); }
From source file:BorderTest.java
public BorderFrame() { setTitle("BorderTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); demoPanel = new JPanel(); buttonPanel = new JPanel(); group = new ButtonGroup(); addRadioButton("Lowered bevel", BorderFactory.createLoweredBevelBorder()); addRadioButton("Raised bevel", BorderFactory.createRaisedBevelBorder()); addRadioButton("Etched", BorderFactory.createEtchedBorder()); addRadioButton("Line", BorderFactory.createLineBorder(Color.BLUE)); addRadioButton("Matte", BorderFactory.createMatteBorder(10, 10, 10, 10, Color.BLUE)); addRadioButton("Empty", BorderFactory.createEmptyBorder()); Border etched = BorderFactory.createEtchedBorder(); Border titled = BorderFactory.createTitledBorder(etched, "Border types"); buttonPanel.setBorder(titled);//from w w w.j a v a2 s . c o m setLayout(new GridLayout(2, 1)); add(buttonPanel); add(demoPanel); }
From source file:MonthPanel.java
protected JPanel createDaysGUI() { JPanel dayPanel = new JPanel(true); dayPanel.setLayout(new GridLayout(0, dayNames.length)); Calendar today = Calendar.getInstance(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.DAY_OF_MONTH, 1); Calendar iterator = (Calendar) calendar.clone(); iterator.add(Calendar.DAY_OF_MONTH, -(iterator.get(Calendar.DAY_OF_WEEK) - 1)); Calendar maximum = (Calendar) calendar.clone(); maximum.add(Calendar.MONTH, +1); for (int i = 0; i < dayNames.length; i++) { JPanel dPanel = new JPanel(true); dPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); JLabel dLabel = new JLabel(dayNames[i]); dPanel.add(dLabel);//from w w w . j a va 2s . co m dayPanel.add(dPanel); } int count = 0; int limit = dayNames.length * 6; while (iterator.getTimeInMillis() < maximum.getTimeInMillis()) { int lMonth = iterator.get(Calendar.MONTH); int lYear = iterator.get(Calendar.YEAR); JPanel dPanel = new JPanel(true); dPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); JLabel dayLabel = new JLabel(); if ((lMonth == month) && (lYear == year)) { int lDay = iterator.get(Calendar.DAY_OF_MONTH); dayLabel.setText(Integer.toString(lDay)); } dPanel.add(dayLabel); dayPanel.add(dPanel); iterator.add(Calendar.DAY_OF_YEAR, +1); count++; } for (int i = count; i < limit; i++) { JPanel dPanel = new JPanel(true); dPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); dPanel.add(new JLabel()); dayPanel.add(dPanel); } return dayPanel; }
From source file:org.pentaho.ui.xul.swing.tags.SwingStatusbarpanel.java
public SwingStatusbarpanel(Element self, XulComponent parent, XulDomContainer domContainer, String tagName) { super("statusbarpanel"); panel = new JPanel(); this.domContainer = domContainer; panel.setBorder(BorderFactory.createLineBorder(Color.gray.brighter())); panel.setOpaque(false);//from w ww.j a v a 2 s.c o m label = new JLabel(); // label.setPreferredSize(new Dimension(50,15)); label.setFont(new Font("Dialog", Font.PLAIN, 11)); setManagedObject(panel); }
From source file:com.aw.swing.mvp.grid.GridManager.java
private void configureGridTitleColor() { JPanel pnlGrid = ipView.getPnlGrid(gridIndex); pnlGrid.setBorder(BorderFactory.createLineBorder(new Color(131, 172, 219))); JPanel pnlTitGrid = ipView.getPnlTitGrid(gridIndex); pnlTitGrid.setBackground(new Color(131, 172, 219)); pnlTitGrid.setLayout(//from ww w . ja v a 2 s.c o m new FormLayout("fill:16dlu:noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,right:pref:grow", "center:16dlu:noGrow")); JLabel lblTitGrid = ipView.getLblTitGrid(gridIndex); lblTitGrid.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14)); lblTitGrid.setForeground(Color.black); numRecords = new JLabel(""); numRecords.setFont(new Font(lblTitGrid.getFont().getName(), Font.BOLD, 14)); numRecords.setForeground(Color.black); numRecords.setVisible(showTotalRegistros); pnlTitGrid.remove(lblTitGrid); CellConstraints cc = new CellConstraints(); pnlTitGrid.add(lblTitGrid, cc.xy(3, 1)); pnlTitGrid.add(numRecords, cc.xy(5, 1)); }
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 ww w . j a va2 s .c o m 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:painting.SwingPaintDemo2.java
public MyPanel() { setBorder(BorderFactory.createLineBorder(Color.black)); }