Java Code Examples for javax.swing.BorderFactory#createLineBorder()
The following examples show how to use
javax.swing.BorderFactory#createLineBorder() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JTextField.java From i18n-editor with MIT License | 6 votes |
/** * Constructs a {@link JTextField} with an initial text. */ public JTextField(String text) { super(text, 25); Border border = BorderFactory.createLineBorder(Colors.scale(UIManager.getColor("Panel.background"), .8f)); setBorder(BorderFactory.createCompoundBorder(border, BorderFactory.createEmptyBorder(5,8,5,8))); getDocument().addUndoableEditListener(e -> undoManager.addEdit(e.getEdit())); // Add undo support getActionMap().put("undo", new UndoAction(undoManager)); getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "undo"); // Add redo support getActionMap().put("redo", new RedoAction(undoManager)); getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "redo"); // Add popup menu support addMouseListener(new JTextComponentMenuListener(this, undoManager)); }
Example 2
Source File: DataTableColumnListCellRenderer.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
public DataTableColumnListCellRenderer() { container = new JPanel(new GridBagLayout()); tableColumnLabel = new JLabel(); focusBorder = BorderFactory.createLineBorder(BORDER_SELECTION_COLOR); noFocusBorder = BorderFactory.createLineBorder(Color.WHITE); GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.insets = new Insets(2, 1, 2, 1); itemConstraint.anchor = GridBagConstraints.WEST; itemConstraint.weightx = 1; itemConstraint.fill = GridBagConstraints.HORIZONTAL; container.add(tableColumnLabel, itemConstraint); }
Example 3
Source File: JTextArea.java From i18n-editor with MIT License | 6 votes |
/** * Constructs a {@link JTextArea}. */ public JTextArea() { super(); Border border = BorderFactory.createLineBorder(Colors.scale(UIManager.getColor("Panel.background"), .8f)); setBorder(BorderFactory.createCompoundBorder(border, BorderFactory.createEmptyBorder(5,8,5,8))); getDocument().addUndoableEditListener(e -> undoManager.addEdit(e.getEdit())); setAlignmentX(LEFT_ALIGNMENT); setLineWrap(true); setWrapStyleWord(true); // Add undo support getActionMap().put("undo", new UndoAction(undoManager)); getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "undo"); // Add redo support getActionMap().put("redo", new RedoAction(undoManager)); getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "redo"); // Add popup menu support addMouseListener(new JTextComponentMenuListener(this, undoManager)); }
Example 4
Source File: UIRes.java From RipplePower with Apache License 2.0 | 6 votes |
public static void addStyle(JScrollPane jScrollPane, String labelName, boolean bottom) { Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY); TitledBorder titled = BorderFactory.createTitledBorder(line, labelName); titled.setTitleFont(GraphicsUtils.getFont("Verdana", 0, 13)); titled.setTitleColor(fontColorTitle); Border empty = null; if (bottom) { empty = new EmptyBorder(5, 8, 5, 8); } else { empty = new EmptyBorder(5, 8, 0, 8); } CompoundBorder border = new CompoundBorder(titled, empty); jScrollPane.setBorder(border); jScrollPane.setForeground(fontColor); jScrollPane.setBackground(Color.WHITE); jScrollPane.setFont(GraphicsUtils.getFont("Monospaced", 0, 13)); jScrollPane.setHorizontalScrollBar(null); }
Example 5
Source File: AbstractGCellRenderer.java From ghidra with Apache License 2.0 | 5 votes |
public AbstractGCellRenderer() { noFocusBorder = BorderFactory.createEmptyBorder(0, 5, 0, 5); Border innerBorder = BorderFactory.createEmptyBorder(0, 4, 0, 4); Border outerBorder = BorderFactory.createLineBorder(Color.YELLOW, 1); focusBorder = BorderFactory.createCompoundBorder(outerBorder, innerBorder); setBorder(noFocusBorder); // disable HTML rendering setHTMLRenderingEnabled(false); setShouldAlternateRowBackgroundColors(true); setOpaque(true); // mimic the default table & list cell renderer }
Example 6
Source File: AdminTool.java From jplag with GNU General Public License v3.0 | 5 votes |
public Component getTableCellRendererComponent(JTable table, Object obj, boolean isSelected, boolean hasFocus, int row, int coloumn) { String str = ""; if (obj != null) str = obj.toString(); setBackground(isSelected ? VERYLIGHTRED : LIGHTRED); if (hasFocus) { if (badFocusBorder == null) badFocusBorder = BorderFactory.createLineBorder(LIGHTRED, 2); setBorder(badFocusBorder); } else setBorder(null); setText(str); return this; }
Example 7
Source File: AttributeDropTextField.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
public AttributeDropTextField(JTree plotConfigurationTree, DataTableColumnListTransferHandler th, SeriesUsageType type) { th.addDragListener(this); this.setFocusable(false); this.setEditable(false); this.setBackground(Color.white); this.setTransferHandler(new DataTableColumnDropTextFieldTransferHandler(plotConfigurationTree, type, this)); ongoingDropBorder = BorderFactory.createLineBorder(ProcessDrawer.BORDER_DRAG_COLOR, 1); dropEndedBorder = BorderFactory.createEmptyBorder(1, 1, 1, 1); }
Example 8
Source File: PlotConfigurationTreeCellRenderer.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
public PlotConfigurationTreeCellRenderer(DataTableColumnListTransferHandler aTH) { aTH.addDragListener(this); ERROR_ICON = SwingTools.createIcon( "16/" + I18N.getMessageOrNull(I18N.getGUIBundle(), "gui.label.plotter.configuratiom_dialog.error_icon")); WARNING_ICON = SwingTools.createIcon( "16/" + I18N.getMessageOrNull(I18N.getGUIBundle(), "gui.label.plotter.configuratiom_dialog.warning_icon")); focusBorder = BorderFactory.createLineBorder(BORDER_SELECTION_COLOR); nonFocusBorder = BorderFactory.createLineBorder(Color.white); draggingNotFocusedBorder = BorderFactory.createLineBorder(ProcessDrawer.INNER_DRAG_COLOR); dimensionAndRangeAxisRenderPanel = new DimensionAndRangeAxisTreeCellPanel(); globalAndValueSourceRenderPanel = new GlobalAndValueSourceTreeCellPanel(); }
Example 9
Source File: Item.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
public static void updateVirtualItemForTheme(Colors currentTheme) { if (currentTheme == null) { selectedThumbBorder = BorderFactory.createLineBorder(new ColorUIResource(122, 170, 233), 2); } else { selectedThumbBorder = BorderFactory.createLineBorder(currentTheme.getFileChooserColors()[1], 2); } }
Example 10
Source File: BorderBuilders.java From visualvm with GNU General Public License v2.0 | 5 votes |
protected Border createInstanceImpl() { Color c = lineColor == null ? null : lineColor.createInstance(); if (c == null) c = Color.BLACK; if (roundedCorners) { return new LineBorder(c, thickness, roundedCorners); } else if (thickness == 1) { return BorderFactory.createLineBorder(c); } else { return BorderFactory.createLineBorder(c, thickness); } }
Example 11
Source File: UIRes.java From RipplePower with Apache License 2.0 | 5 votes |
public static void addStyle(JComboBox<Object> textField, String labelName) { Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY); TitledBorder titled = BorderFactory.createTitledBorder(line, labelName); titled.setTitleFont(GraphicsUtils.getFont("Verdana", 0, 13)); titled.setTitleColor(fontColorTitle); Border empty = new EmptyBorder(0, 8, 0, 8); CompoundBorder border = new CompoundBorder(titled, empty); textField.setBorder(border); textField.setForeground(fontColor); textField.setFont(GraphicsUtils.getFont("Monospaced", 0, 13)); }
Example 12
Source File: RPPopMenuItem.java From RipplePower with Apache License 2.0 | 5 votes |
public RPPopMenuItem(String name) { super(name); setForeground(new LColor(255, 255, 255)); setBackground(new LColor(18, 18, 18)); setContentAreaFilled(true); setFocusPainted(false); Border line = BorderFactory.createLineBorder(new LColor(80, 80, 80)); Border empty = new EmptyBorder(4, 4, 4, 4); CompoundBorder border = new CompoundBorder(line, empty); setBorder(border); getModel().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { ButtonModel model = (ButtonModel) e.getSource(); if (model.isRollover()) { setBackground(new LColor(120, 20, 20)); } else if (model.isArmed() || model.isPressed()) { setBackground(new LColor(0, 0, 0)); } else if (model.isSelected()) { setBackground(new LColor(0, 0, 0)); } else { setBackground(new LColor(18, 18, 18)); } } }); }
Example 13
Source File: BorderBuilders.java From netbeans with Apache License 2.0 | 5 votes |
protected Border createInstanceImpl() { Color c = lineColor == null ? null : lineColor.createInstance(); if (c == null) c = Color.BLACK; if (roundedCorners) { return new LineBorder(c, thickness, roundedCorners); } else if (thickness == 1) { return BorderFactory.createLineBorder(c); } else { return BorderFactory.createLineBorder(c, thickness); } }
Example 14
Source File: QuickSearchComboBar.java From netbeans with Apache License 2.0 | 5 votes |
/** * Get customizable border for QuickSearch. See bug 246907. * * @return Custom border if defined in {@link UIManager} or default line * border. */ private Border getQuickSearchBorder() { Border border = UIManager.getBorder("nb.quicksearch.border"); //NOI18N return border != null ? border : BorderFactory.createLineBorder(getComboBorderColor()); }
Example 15
Source File: ETable.java From netbeans with Apache License 2.0 | 5 votes |
/** * Sets all the cells in the <code>ETable</code> to be editable if * <code>fullyEditable</code> is true. * if <code>fullyEditable</code> is false, sets the table cells into * their default state as in JTable. * * @param fullyEditable true if the table is meant to be fully editable. * false if the table is meant to take the defalut * state for editing. * @see #isFullyEditable() */ public void setFullyEditable(boolean fullyEditable) { if (fullyEditable) { editing = FULLY_EDITABLE; if(!getShowHorizontalLines()) { setShowHorizontalLines(true); } Color colorBorderAllEditable = UIManager.getColor("Table.borderAllEditable"); Border border = null; if (colorBorderAllEditable != null) { border = BorderFactory.createLineBorder(colorBorderAllEditable); } else { border = BorderFactory.createLineBorder(Color.GRAY); } Border filler = BorderFactory.createLineBorder(getBackground()); CompoundBorder compound = new CompoundBorder(border, filler); setBorder(new CompoundBorder(compound, border)); } else { editing = DEFAULT; setBorder( null ); } Color c = UIManager.getColor("Table.defaultGrid"); if (c != null) { setGridColor(c); } if (isFullyNonEditable()) { setupSearch(); } }
Example 16
Source File: ColorPropertyCellRenderer.java From openAGV with Apache License 2.0 | 5 votes |
/** * Creates a new instance of ColorPropertyCellRenderer */ public ColorPropertyCellRenderer() { super(); setOpaque(true); Border insideBorder = BorderFactory.createLineBorder(Color.black); Border outsideBorder = BorderFactory.createMatteBorder(5, 10, 5, 10, Color.white); setBorder(BorderFactory.createCompoundBorder(outsideBorder, insideBorder)); }
Example 17
Source File: HelpSubtitlesDialog.java From dualsub with GNU General Public License v3.0 | 4 votes |
@Override protected void initComponents() { // Features final int marginLeft = 23; this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setResizable(false); getContentPane().setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setLayout(null); panel.setPreferredSize(new Dimension(getWidth(), getHeight() + 620)); panel.setBackground(parent.getBackground()); JScrollPane scroll = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); getContentPane().add(scroll); // Title final String title = I18N.getHtmlText("Window.mergeButton.text"); setTitle(I18N.getText("Window.name.text")); JLabel lblTitle = new JLabel(title); lblTitle.setFont(new Font("Lucida", Font.BOLD, 20)); lblTitle.setBounds(marginLeft, 21, 435, 25); panel.add(lblTitle); // Content JLabel lblContent01 = new JLabel( I18N.getHtmlText("HelpSubtitlesDialog.help.01")); lblContent01.setBounds(marginLeft, 50, 435, 40); panel.add(lblContent01); ImageIcon sampleIcon = new ImageIcon( ClassLoader.getSystemResource("img/vlc-1.1.11-sample.png")); JLabel sampleLabel = new JLabel(); sampleLabel.setIcon(sampleIcon); sampleLabel.setBounds(marginLeft, 90, 435, 334); panel.add(sampleLabel); ImageIcon sampleIcon2 = new ImageIcon( ClassLoader.getSystemResource("img/vlc-2.1.15-sample.png")); JLabel sampleLabel2 = new JLabel(); sampleLabel2.setIcon(sampleIcon2); sampleLabel2.setBounds(marginLeft, 424, 435, 318); panel.add(sampleLabel2); JLabel lblContent02 = new JLabel( I18N.getHtmlText("HelpSubtitlesDialog.help.02")); lblContent02.setBounds(marginLeft, 742, 435, 100); panel.add(lblContent02); JLabel lblContent03 = new JLabel( I18N.getHtmlText("HelpSubtitlesDialog.help.03")); lblContent03.setBounds(marginLeft, 842, 435, 60); panel.add(lblContent03); JLabel lblContent04 = new JLabel( I18N.getHtmlText("HelpSubtitlesDialog.help.04")); lblContent04.setBounds(marginLeft, 902, 435, 140); panel.add(lblContent04); // Borders (for debug purposes) if (log.isTraceEnabled()) { Border border = BorderFactory.createLineBorder(Color.black); lblTitle.setBorder(border); lblContent01.setBorder(border); lblContent02.setBorder(border); lblContent03.setBorder(border); lblContent04.setBorder(border); panel.setBorder(border); } }
Example 18
Source File: HelpPlayerDialog.java From dualsub with GNU General Public License v3.0 | 4 votes |
@Override protected void initComponents() { // Features final int marginLeft = 23; this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setResizable(false); getContentPane().setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setLayout(null); panel.setPreferredSize(new Dimension(getWidth(), getHeight() + 140)); panel.setBackground(parent.getBackground()); JScrollPane scroll = new JScrollPane(panel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); getContentPane().add(scroll); // Title final String title = I18N.getHtmlText("PanelOutput.border.text"); setTitle(I18N.getText("Window.name.text")); JLabel lblTitle = new JLabel(title); lblTitle.setFont(new Font("Lucida", Font.BOLD, 20)); lblTitle.setBounds(marginLeft, 21, 435, 25); panel.add(lblTitle); // Content JLabel lblContent01 = new JLabel( I18N.getHtmlText("HelpPlayerDialog.help.01")); lblContent01.setBounds(marginLeft, 50, 435, 120); panel.add(lblContent01); JButton lblContent02 = new UrlButton(I18N.getHtmlText( "HelpPlayerDialog.help.02", Html.LINK), parent.getCursor(), parent.getBackground(), new Rectangle(marginLeft + 20, 170, 240, 20)); panel.add(lblContent02); UrlButton lblContent03 = new UrlButton(I18N.getHtmlText( "HelpPlayerDialog.help.03", Html.LINK), parent.getCursor(), parent.getBackground(), new Rectangle(marginLeft + 20, 190, 240, 20)); panel.add(lblContent03); UrlButton lblContent04 = new UrlButton(I18N.getHtmlText( "HelpPlayerDialog.help.04", Html.LINK), parent.getCursor(), parent.getBackground(), new Rectangle(marginLeft + 20, 210, 240, 20)); panel.add(lblContent04); JLabel lblContent05 = new JLabel( I18N.getHtmlText("HelpPlayerDialog.help.05")); lblContent05.setBounds(marginLeft, 230, 435, 180); panel.add(lblContent05); JLabel lblContent06 = new JLabel( I18N.getHtmlText("HelpPlayerDialog.help.06")); lblContent06.setBounds(marginLeft, 410, 435, 100); panel.add(lblContent06); JLabel lblContent07 = new JLabel( I18N.getHtmlText("HelpPlayerDialog.help.07")); lblContent07.setBounds(marginLeft + 20, 510, 415, 40); panel.add(lblContent07); // Borders (for debug purposes) if (log.isTraceEnabled()) { Border border = BorderFactory.createLineBorder(Color.black); lblTitle.setBorder(border); lblContent01.setBorder(border); lblContent02.setBorderPainted(true); lblContent02.setBorder(border); lblContent03.setBorder(border); lblContent03.setBorderPainted(true); lblContent04.setBorder(border); lblContent04.setBorderPainted(true); lblContent05.setBorder(border); lblContent06.setBorder(border); lblContent07.setBorder(border); panel.setBorder(border); } }
Example 19
Source File: UnitInfoPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void init(String unitName, String unitType, String unitDescription) { setOpaque(false); setLayout(new BorderLayout(10, 20)); // this.setSize(350, 400); // undecorated 301, 348 ; decorated : 303, 373 JPanel mainPanel = new JPanel(new FlowLayout());// new BorderLayout()); mainPanel.setOpaque(false); mainPanel.setBackground(new Color(0, 0, 0, 128)); // setMinimumSize() this.add(mainPanel, BorderLayout.NORTH); JPanel westPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));// new BorderLayout()); westPanel.setOpaque(false); westPanel.setBackground(new Color(0, 0, 0, 128)); // setMinimumSize() this.add(westPanel, BorderLayout.WEST); JPanel eastPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));// new BorderLayout()); eastPanel.setOpaque(false); eastPanel.setBackground(new Color(0, 0, 0, 128)); // setMinimumSize() this.add(eastPanel, BorderLayout.EAST); // Creating the text Input JTextField tf1 = new JTextField("", 15); tf1.setHorizontalAlignment(JTextField.CENTER); tf1.setOpaque(false); tf1.setFocusable(false); tf1.setBackground(new Color(92, 83, 55, 128)); tf1.setColumns(20); Border border = BorderFactory.createLineBorder(Color.gray, 2); tf1.setBorder(border); tf1.setText(unitName); tf1.setForeground(Color.BLACK); tf1.setFont(new Font("Arial", Font.BOLD, 14)); mainPanel.add(tf1); JTextArea ta = new JTextArea(); String type = "TYPE: "; String description = "DESCRIPTION: "; ta.setLineWrap(true); ta.setFocusable(false); ta.setWrapStyleWord(true); ta.setText(type + "\n"); ta.append(unitType + "\n\n"); ta.append(description + "\n"); ta.append(unitDescription); ta.setCaretPosition(0); ta.setEditable(false); ta.setForeground(Color.black); ta.setFont(new Font("Dialog", Font.PLAIN, 14)); ta.setOpaque(false); ta.setBackground(new Color(92, 83, 55, 128)); CustomScroll scr = new CustomScroll(ta); scr.setSize(PopUpUnitMenu.D_WIDTH - 50 , PopUpUnitMenu.D_HEIGHT); add(scr, BorderLayout.CENTER); JPanel southPanel = new JPanel(); add(southPanel, BorderLayout.SOUTH); southPanel.setOpaque(false); southPanel.setBackground(new Color(0, 0, 0, 128)); setVisible(true); }
Example 20
Source File: DataToolTable.java From osp with GNU General Public License v3.0 | 4 votes |
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { // value is data column name String realname = (value==null) ? "" : value.toString(); //$NON-NLS-1$ String name = realname; if (OSPRuntime.isMac()) { name = TeXParser.removeSubscripting(name); } Component c = renderer.getTableCellRendererComponent(table, name, isSelected, hasFocus, row, col); if (headerFont==null) headerFont = c.getFont(); int labelCol = convertColumnIndexToView(0); int xCol = (labelCol==0) ? 1 : 0; int yCol = (labelCol<2) ? 2 : 1; if(unselectedBG==null) { unselectedBG = c.getBackground(); } // backup color in case c has none if(unselectedBG==null) { unselectedBG = javax.swing.UIManager.getColor("Panel.background"); //$NON-NLS-1$ } rowBG = dataToolTab.plot.getBackground(); Color bgColor = (col==xCol)? DataToolTable.xAxisColor: (col==yCol)? DataToolTable.yAxisColor: rowBG; if(!(c instanceof JComponent)) { return c; } JComponent comp = (JComponent) c; java.awt.Dimension dim = comp.getPreferredSize(); dim.height += 1; dim.height = Math.max(getRowHeight()+2, dim.height); panel.setPreferredSize(dim); javax.swing.border.Border border = comp.getBorder(); if(border instanceof javax.swing.border.EmptyBorder) { border = BorderFactory.createLineBorder(Color.LIGHT_GRAY); } panel.setBorder(border); // determine font: italics if undeletable, bold if sorted column Font font; Dataset data = getDataset(realname); if(!dataToolTab.isDeletable(data)) { font = getSortedColumn()!=convertColumnIndexToModel(col)? headerFont.deriveFont(Font.PLAIN+Font.ITALIC) : headerFont.deriveFont(Font.BOLD+Font.ITALIC); } else { font = getSortedColumn()!=convertColumnIndexToModel(col)? headerFont.deriveFont(Font.PLAIN) : headerFont.deriveFont(Font.BOLD); } int[] cols = getSelectedColumns(); boolean selected = false; for(int i = 0; i<cols.length; i++) { selected = selected||(cols[i]==col); } selected = selected&&(convertColumnIndexToModel(col)>0); bgColor = selected? selectedHeaderBG: bgColor; // special case: textline doesn't work on OSX if (OSPRuntime.isMac()) { comp.setFont(font); comp.setBackground(bgColor); comp.setForeground(selected ? selectedHeaderFG : comp.getForeground()); if (comp instanceof JLabel) { ((JLabel)comp).setHorizontalAlignment(SwingConstants.CENTER); } return comp; } textLine.setText(name); textLine.setFont(font); textLine.setColor(selected ? selectedHeaderFG : comp.getForeground()); textLine.setBackground(bgColor); panel.setBackground(bgColor); return panel; }