private JButton createArrowButton() { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0, 1, 5, 1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0, 0, 3, 0)); //We want to use the same font as those in the titled border font Font font = BorderFactory.createTitledBorder("Sample").getTitleFont(); Color color = BorderFactory.createTitledBorder("Sample").getTitleColor(); button.setFont(font); button.setForeground(color); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new CollapsiblePanel.ExpandAndCollapseAction()); return button; }
/** * Returns a button with an arrow icon and a collapse/expand action listener. * * @return button Button which is used in the titled border component */ private JButton createArrowButton () { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0,1,5,1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0,0,3,0)); //We want to use the same font as those in the titled border font Font font = BorderFactory.createTitledBorder("Sample").getTitleFont(); Color color = BorderFactory.createTitledBorder("Sample").getTitleColor(); button.setFont(font); button.setForeground(color); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new CollapsiblePanel.ExpandAndCollapseAction()); return button; }
/** * Returns a button with an arrow icon and a collapse/expand action listener. * * @return button Button which is used in the titled border component */ private JButton createArrowButton () { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0,1,5,1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0,0,3,0)); //We want to use the same font as those in the titled border font Font font = BorderFactory.createTitledBorder("Sample").getTitleFont(); Color color = BorderFactory.createTitledBorder("Sample").getTitleColor(); button.setFont(font); button.setForeground(color); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new CollapsiblePanel.ExpandAndCollapseAction()); return button; }
/** * Returns a button with an arrow icon and a collapse/expand action listener. * * @return button Button which is used in the titled border component */ private JButton createArrowButton () { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0,1,5,1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0,0,3,0)); //We want to use the same font as those in the titled border font Font font = BorderFactory.createTitledBorder("Sample").getTitleFont(); Color color = BorderFactory.createTitledBorder("Sample").getTitleColor(); button.setFont(font); button.setForeground(color); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new CollapsiblePanel.ExpandAndCollapseAction()); return button; }
/** * Returns a button with an arrow icon and a collapse/expand action listener. * * @return button Button which is used in the titled border component */ private JButton createArrowButton() { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0, 1, 5, 1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0, 0, 3, 0)); //We want to use the same font as those in the titled border font Font font = BorderFactory.createTitledBorder("Sample").getTitleFont(); Color color = BorderFactory.createTitledBorder("Sample").getTitleColor(); button.setFont(font); button.setForeground(color); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new CollapsablePanel.ExpandAndCollapseAction()); return button; }
/** * Returns a button with an arrow icon and a collapse/expand action listener. * * @return button Button which is used in the titled border component */ private JButton createArrowButton () { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0,1,5,1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0,0,3,0)); //We want to use the same font as those in the titled border font Font font = BorderFactory.createTitledBorder("Sample").getTitleFont(); Color color = BorderFactory.createTitledBorder("Sample").getTitleColor(); button.setFont(font); button.setForeground(color); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new CyCollapsiblePanel.ExpandAndCollapseAction()); return button; }
/** * Returns a button with an arrow icon and a collapse/expand action listener. * * @return button Button which is used in the titled border component */ private JButton createArrowButton() { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0, 1, 5, 1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0, 0, 3, 0)); //We want to use the same font as those in the titled border font Font font = BorderFactory.createTitledBorder("Sample").getTitleFont(); Color color = BorderFactory.createTitledBorder("Sample").getTitleColor(); button.setFont(font); button.setForeground(color); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new CollapsablePanel.ExpandAndCollapseAction()); return button; }
/** * Returns a button with an arrow icon and a collapse/expand action * listener. * * @return button Button which is used in the titled border component */ private JButton createArrowButton() { JButton button = new JButton("arrow", iconArrow[COLLAPSED]); button.setBorder(BorderFactory.createEmptyBorder(0, 1, 5, 1)); button.setVerticalTextPosition(AbstractButton.CENTER); button.setHorizontalTextPosition(AbstractButton.LEFT); button.setMargin(new Insets(0, 0, 3, 0)); // We want to use the same font as those in the titled border font Font font = BorderFactory.createTitledBorder("Sample").getTitleFont(); Color color = BorderFactory.createTitledBorder("Sample").getTitleColor(); button.setFont(font); button.setForeground(color); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(new BasicCollapsiblePanel.ExpandAndCollapseAction()); return button; }
/** * Creates and lays out the controls inside this panel. * <p> * This method is called upon initialization only. * </p> * * @param aExpanded Flag indicating if the panel must be initially expanded or hidden. */ private void initControls(boolean aExpanded) { String titleText = visualizer.getTitle(); titleExpanded = "- " + titleText; titleHidden = "+ " + titleText; title = BorderFactory.createTitledBorder(titleExpanded); setBorder(title); titleHeight = title.getMinimumSize(this).height / 2; normalTitleColor = title.getTitleColor(); selTitleColor = Utils.invertOf(normalTitleColor); addMouseListener(this); addMouseMotionListener(this); if (aExpanded == false) { setExpanded(false); } }
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); } }