TitledBorder titledBorder = (TitledBorder)jPanel1.getBorder(); titledBorder.setTitleColor(Color.red);
((javax.swing.border.TitledBorder)panel_1.getBorder()).setTitleColor(Color.WHITE);
/** */ private static void disableBorderTitle(TitledBorder border) { final Color color = UIManager.getColor( "Label.disabledForeground"); //NOI18N if (color != null) { border.setTitleColor(color); } }
/** * Gives the specified JPanel a TitledBorder with the specified title. This * method ensures consistency of borders for JPanels used within * ClusterConfigSheets and allows for sharing of border datastructures. */ protected void setBorder(JPanel panel, String title) { TitledBorder titledBorder = BorderFactory.createTitledBorder(ETCHED_BORDER, title); titledBorder.setTitleColor(Color.black); panel.setBorder(BorderFactory.createCompoundBorder(titledBorder, EMPTY_BORDER)); }
TitledBorder titled = BorderFactory.createTitledBorder("\u2615"); titled.setTitleFont(new Font("Dialog", Font.PLAIN, 32)); titled.setTitleColor(Color.blue); label.setBorder(titled);
/** * Creation of a JPanel that will contain panels of <code>GUITunableHandler</code> * A layout will be set for this <i>"container"</i> of panels (horizontally or vertically), * and a title (displayed or not) * * @param title of the panel * @param alignment the way the panels will be set in this <i>"container</i> panel * @param groupTitle parameter to choose whether or not the title of the panel has to be displayed * * @return a container for <code>GUITunableHandler</code>' panels */ private JPanel createSimplePanel(final String title, final Boolean vertical, final Boolean displayed) { JPanel outPanel = new JPanel(); TitledBorder titleborder = BorderFactory.createTitledBorder(title); titleborder.setTitleColor(Color.BLUE); if (displayed == null || displayed) outPanel.setBorder(titleborder); if (vertical == null || vertical) outPanel.setLayout(new BoxLayout(outPanel, BoxLayout.PAGE_AXIS)); else if (vertical != null) outPanel.setLayout(new BoxLayout(outPanel, BoxLayout.LINE_AXIS)); return outPanel; }
/** * Creates a Titled Border with appropriate font settings. * @param title Title. * @return TitledBorder Object. */ public static TitledBorder createTitledBorder (String title) { TitledBorder border = new TitledBorder(title); Font font = border.getTitleFont(); Font newFont = new Font (font.getFamily(), Font.BOLD, font.getSize()+2); border.setTitleFont(newFont); border.setTitleColor(new Color(102,51,51)); return border; } }
/** * Creates a Titled Border with appropriate font settings. * @param title Title. * @return TitledBorder Object. */ public static TitledBorder createTitledBorder (String title) { TitledBorder border = new TitledBorder(title); Font font = border.getTitleFont(); Font newFont = new Font (font.getFamily(), Font.BOLD, font.getSize()+2); border.setTitleFont(newFont); border.setTitleColor(new Color(102,51,51)); return border; } }
private void rcUpdateComponentState() { if (this.usrConfigJRadioButton.isSelected()) { this.sharedDirJTextField.setEnabled(false); this.selectSharedDirJButton.setEnabled(false); this.syncWithUsrConfigJButton.setEnabled(false); this.shareDirPanelBorder.setTitleColor(Color.GRAY); this.manualRootIdAssignJCheckBox.setEnabled(true); } else { this.sharedDirJTextField.setEnabled(true); this.selectSharedDirJButton.setEnabled(true); if (this.sharedDirJTextField.getText().trim().length() > 0) { this.syncWithUsrConfigJButton.setEnabled(true); } else { this.syncWithUsrConfigJButton.setEnabled(false); } this.shareDirPanelBorder.setTitleColor(this.usrConfigJRadioButton.getForeground()); this.manualRootIdAssignJCheckBox.setSelected(false); this.manualRootIdAssignJCheckBox.setEnabled(false); } this.sharedDirJPanel.repaint(); }
private void setSliderTitle(JSlider slider, Color color, String str) { //Border empty = BorderFactory.createTitledBorder( BorderFactory.createEmptyBorder() ); TitledBorder tb = new TitledBorder(BorderFactory.createEtchedBorder(), //empty, "", TitledBorder.CENTER, TitledBorder.ABOVE_BOTTOM, new Font("Sans", Font.PLAIN, 11)); tb.setTitleJustification(TitledBorder.LEFT); tb.setTitle(str); tb.setTitleColor(color); slider.setBorder(tb); }
private JSlider makeTitledVerticalSilder(String string, Color color, int minVal, int maxVal, int val) { //Border empty = BorderFactory.createTitledBorder( BorderFactory.createEmptyBorder() ); JSlider slider = new JSlider(JSlider.VERTICAL, minVal, maxVal, val ); TitledBorder tb = new TitledBorder(BorderFactory.createEtchedBorder(), //empty, "", TitledBorder.CENTER, TitledBorder.ABOVE_BOTTOM, new Font("Sans", Font.PLAIN, 11)); tb.setTitle(string); //tb.setTitleJustification(TitledBorder.LEFT); tb.setTitleColor(color); slider.setBorder(tb); slider.setMajorTickSpacing((maxVal - minVal)/6 ); slider.setPaintTicks(true); slider.addChangeListener( this ); slider.addChangeListener( this ); slider.addMouseListener(this); return slider; }
public XorPanel(final String title, final GUITunableHandler g) { super(); gh = g; gh.addDependent(new GUITunableHandlerSwitchListener()); switchPanel = new JPanel(); contentPanel = new JPanel(new CyCardLayout()); TitledBorder titleborder = BorderFactory.createTitledBorder(title); titleborder.setTitleColor(Color.GREEN); setBorder(titleborder); setLayout(new BoxLayout(this,BoxLayout.PAGE_AXIS)); //setBorder(BorderFactory.createTitledBorder(title)); super.add(switchPanel); super.add(contentPanel); }
private JSlider makeTitledSilder(String string, Color color, int minVal, int maxVal, int val) { //Border empty = BorderFactory.createTitledBorder( BorderFactory.createEmptyBorder() ); JSlider slider = new JSlider(JSlider.HORIZONTAL, minVal, maxVal, val ); TitledBorder tb = new TitledBorder(BorderFactory.createEtchedBorder(), //empty, "", TitledBorder.CENTER, TitledBorder.ABOVE_BOTTOM, new Font("Sans", Font.PLAIN, 11)); tb.setTitle(string); tb.setTitleJustification(TitledBorder.LEFT); tb.setTitleColor(color); slider.setBorder(tb); slider.setMajorTickSpacing((maxVal - minVal)/6 ); //slider.setMajorTickSpacing((maxVal - minVal)/10 ); slider.setPaintTicks(true); slider.addChangeListener( this ); slider.addChangeListener( this ); slider.addMouseListener(this); return slider; }
/** * Creates the titled border. * * @param title * the title * @return the border */ public static Border createTitledBorder(final String title) { final TitledBorder b = BorderFactory.createTitledBorder(""); b.setTitle(JKMessage.get(title, true)); b.setTitleJustification(TitledBorder.DEFAULT_JUSTIFICATION); b.setTitlePosition(TitledBorder.CENTER); b.setTitleColor(JKColors.TITLE_BORDER_BG); return b; }
currentDiscourse = _discourse; TitledBorder tempBorder = new TitledBorder(new LineBorder(Color.black)," Levels "); tempBorder.setTitleColor(Color.black); tempBorder.setTitleFont(MMAX2.getStandardFont()); setBorder(tempBorder);
public void mouseExited(MouseEvent e) { if (getCursor() == onTitleCursor) { setCursor(null); title.setTitleColor(normalTitleColor); setToolTipText(null); repaint(); } }
/** * Creates a titled border instance that can be applied to any Swing * component. */ public Border createBorder(Component comp) { TitledBorder b = new TitledBorder(getTitle()); b.setTitlePosition(getPosition()); b.setTitleJustification(getJustification()); b.setTitleColor(new ColorProxy(getTextColorProperty())); return b; }
@Override public void updateSliderProoperties(JSliderW slider) { JPanel panel = (JPanel) slider.getParent(); int rate = getCurrentCineRate(); StringBuilder buffer = new StringBuilder(Messages.getString("SliderCineListener.img")); //$NON-NLS-1$ buffer.append(StringUtil.COLON_AND_SPACE); buffer.append(getValueToDisplay()); if (slider.isdisplayValueInTitle() && panel != null && panel.getBorder() instanceof TitledBorder) { if (rate > 0) { buffer.append(" - "); //$NON-NLS-1$ buffer.append(Messages.getString("SliderCineListener.cine")); //$NON-NLS-1$ buffer.append(StringUtil.COLON_AND_SPACE); buffer.append(rate); if (TIME.SECOND.equals(time)) { buffer.append(Messages.getString("SliderCineListener.fps")); //$NON-NLS-1$ } else if (TIME.MINUTE.equals(time)) { buffer.append(Messages.getString("SliderCineListener.fpm")); //$NON-NLS-1$ } else if (TIME.HOUR.equals(time)) { buffer.append(Messages.getString("SliderCineListener.fph")); //$NON-NLS-1$ } } ((TitledBorder) panel.getBorder()).setTitleColor( rate > 0 && rate < (getSpeed() - 1) ? Color.red : UIManager.getColor("TitledBorder.titleColor")); //$NON-NLS-1$ ((TitledBorder) panel.getBorder()).setTitle(buffer.toString()); panel.repaint(); } else { slider.setToolTipText(buffer.toString()); } }
public void mouseMoved(MouseEvent e) { if (e.getY() <= titleHeight) { if (getCursor() != onTitleCursor) { setCursor(onTitleCursor); title.setTitleColor(selTitleColor); if (isExpanded()) { setToolTipText(Messages.TT_CLICK2HIDE); } else { setToolTipText(Messages.TT_CLICK2EXPAND); } repaint(); } } else { if (getCursor() == onTitleCursor) { setCursor(null); title.setTitleColor(normalTitleColor); setToolTipText(null); repaint(); } } }
public static void syncWithTheme(Border border, Component c) { if (border instanceof TitledBorder) { TitledBorder tb = (TitledBorder) border; Color pen = currentTheme(c).getPenColor(); tb.setTitleColor(ifReplace(tb.getTitleColor(), pen)); } else if (border instanceof CompoundBorder) { CompoundBorder cb = (CompoundBorder) border; syncWithTheme(cb.getInsideBorder(), c); syncWithTheme(cb.getOutsideBorder(), c); } }