Java Code Examples for javax.swing.JButton#setBorderPainted()

The following examples show how to use javax.swing.JButton#setBorderPainted() . 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: ShapeBoard.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Build the panel of shapes for a given set.
 *
 * @param set the given set of shapes
 * @return the panel of shapes for the provided set
 */
private Panel buildShapesPanel (ShapeSet set)
{
    Panel panel = new Panel();
    panel.setNoInsets();
    panel.setPreferredSize(new Dimension(BOARD_WIDTH, getSetHeight(set)));

    FlowLayout layout = new FlowLayout();
    layout.setAlignment(FlowLayout.LEADING);
    panel.setLayout(layout);

    // Button to close this shapes panel and return to sets panel
    JButton close = new JButton(set.getName());
    close.addActionListener(closeListener);
    close.setToolTipText("Back to shape sets");
    close.setBorderPainted(false);
    panel.add(close);
    panel.addKeyListener(keyListener);

    // One button per shape
    addButtons(panel, set.getSortedShapes());

    return panel;
}
 
Example 2
Source File: Toolbar.java    From android-classyshark with Apache License 2.0 6 votes vote down vote up
private JButton buildExportButton() {
    JButton result = new JButton(theme.getExportIcon());

    result.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            toolbarController.onExportButtonPressed();
        }
    });

    result.setToolTipText("Export");
    result.setBorderPainted(false);
    result.setEnabled(false);

    return result;
}
 
Example 3
Source File: NotifyExcPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static JComponent getDetailsPanel(String summary) {
    JPanel details = new JPanel(new GridBagLayout());
    details.setOpaque(false);
    JLabel lblMessage = new JLabel(summary);
    
    JButton reportLink = new JButton("<html><a href=\"_blank\">" + NbBundle.getMessage(NotifyExcPanel.class, "NTF_ExceptionalExceptionReport")); //NOI18N
    reportLink.setFocusable(false);
    reportLink.setBorder(BorderFactory.createEmptyBorder());
    reportLink.setBorderPainted(false);
    reportLink.setFocusPainted(false);
    reportLink.setOpaque(false);
    reportLink.setContentAreaFilled(false);
    reportLink.addActionListener(flash);
    reportLink.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    details.add(reportLink, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
    details.add(lblMessage, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 3, 0), 0, 0));
    return details;
}
 
Example 4
Source File: CopyCellRenderer.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the button for the detection if it doesn't already exist.
 * 
 * @param table Table.
 * @param row Row.
 * @return Button for the row.
 */
private JButton getButton(JTable table, int row) {
  Integer rowNum = Integer.valueOf(row);
  if (buttons.containsKey(rowNum)) {
    return buttons.get(rowNum);
  }
  JButton button = new JButton(Utilities.getImageIcon(
      "gnome-edit-copy.png", EnumImageSize.SMALL));
  button.setBorderPainted(false);
  button.setContentAreaFilled(false);
  Object value = table.getValueAt(row, copyColumn);
  button.setActionCommand(value != null ? value.toString() : "");
  button.setEnabled(true);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "copyCell", "actionCommand"));
  buttons.put(rowNum, button);
  return button;
}
 
Example 5
Source File: Toolbar.java    From android-classyshark with Apache License 2.0 6 votes vote down vote up
private JButton buildBackButton() {
    JButton result = new JButton(theme.getBackIcon());
    result.setToolTipText("Back");

    result.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            toolbarController.onGoBackPressed();
        }
    });

    result.setBorderPainted(false);
    result.setFocusPainted(true);
    result.setEnabled(false);

    return result;
}
 
Example 6
Source File: XDMComboBoxUI.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
protected JButton createArrowButton() {
	JButton button = new CustomButton();
	button.setBackground(ColorResource.getDarkBgColor());
	button.setIcon(ImageResource.getIcon("down.png", 10, 10));
	button.setBorderPainted(false);
	button.setFocusPainted(false);
	button.setName("ComboBox.arrowButton");
	return button;
}
 
Example 7
Source File: CloseButtonFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a big 'close' JButton with close icon, rollover icon and pressed icon according to Look and Feel
 *
 * @return JButton with close icons.
 */
public static JButton createBigCloseButton() {
    JButton closeButton = new JButton();
    int size = 19;
    closeButton.setPreferredSize(new Dimension(size, size));
    closeButton.setContentAreaFilled(false);
    closeButton.setFocusable(false);
    closeButton.setBorder(BorderFactory.createEmptyBorder());
    closeButton.setBorderPainted(false);
    closeButton.setRolloverEnabled(true);
    closeButton.setIcon(getBigCloseTabImage());
    closeButton.setRolloverIcon(getBigCloseTabRolloverImage());
    closeButton.setPressedIcon(getBigCloseTabPressedImage());
    return closeButton;
}
 
Example 8
Source File: TerminalContainerTopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void initToolbar() {
    Insets ins = actionsBar.getMargin();
    JButton dummy = new JButton();
    dummy.setBorderPainted(false);
    dummy.setOpaque(false);
    dummy.setText(null);
    dummy.setIcon(new Icon() {

        @Override
        public int getIconHeight() {
            return 16;
        }

        @Override
        public int getIconWidth() {
            return 16;
        }

        @SuppressWarnings(value = "empty-statement")
        @Override
        public void paintIcon(Component c, Graphics g, int x, int y) {
            ;
        }
    });
    actionsBar.add(dummy);
    Dimension buttonPref = dummy.getPreferredSize();
    Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom);
    actionsBar.setMinimumSize(minDim);
    actionsBar.setPreferredSize(minDim);
    actionsBar.remove(dummy);
    actionsBar.setBorder(new RightBorder());
    actionsBar.setBorderPainted(true);
}
 
Example 9
Source File: MessageBox.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
void applyStyle(JButton btn) {
	btn.addActionListener(this);
	btn.setBackground(ColorResource.getDarkerBgColor());// );
	btn.setForeground(Color.WHITE);
	btn.setFocusable(true);
	// btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getBigFont());
	btn.setBorderPainted(false);
	btn.setMargin(new Insets(0, 0, 0, 0));
	// btn.setFocusPainted(false);
	btn.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "pressed");
	btn.getInputMap(WHEN_FOCUSED).put(KeyStroke.getKeyStroke("released ENTER"), "released");
}
 
Example 10
Source File: PalettePanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void prepareSearchPanel() {
    if( searchpanel == null ) {
        searchpanel = new SearchPanel();

        JLabel lbl = new JLabel(NbBundle.getMessage(PalettePanel.class, "LBL_QUICKSEARCH")); //NOI18N
        searchpanel.setLayout(new GridBagLayout());
        searchpanel.add(lbl, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(searchTextField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        searchpanel.add(new JLabel(), new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
        lbl.setLabelFor(searchTextField);
        searchTextField.setColumns(10);
        searchTextField.setMaximumSize(searchTextField.getPreferredSize());
        searchTextField.putClientProperty("JTextField.variant", "search"); //NOI18N
        lbl.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));

        JButton btnCancel = new JButton(ImageUtilities.loadImageIcon("org/netbeans/modules/palette/resources/cancel.png", true));
        btnCancel.setBorder(BorderFactory.createEmptyBorder());
        btnCancel.setBorderPainted(false);
        btnCancel.setOpaque(false);
        btnCancel.setContentAreaFilled(false);
        searchpanel.add(btnCancel, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
        btnCancel.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                removeSearchField();
            }
        });
    }
}
 
Example 11
Source File: RefreshUrlPage.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JButton createButton1(String name, int x, int y) {
	JButton btn = new CustomButton(StringResource.get(name));
	btn.setBackground(ColorResource.getDarkBtnColor());
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getNormalFont());
	Dimension d = btn.getPreferredSize();
	btn.setBounds(x, y, d.width, d.height);
	// btn.addActionListener(this);
	return btn;
}
 
Example 12
Source File: MainFrame.java    From ios-image-util with MIT License 5 votes vote down vote up
/**
 * Set preferences to Menu button.
 *
 * @param button
 * @param foregroundColor
 * @param backgroundColor
 * @param font
 * @return
 */
private JButton initMenuButton(JButton button, Color foregroundColor, Color backgroundColor, Font font) {
	button.setBackground(backgroundColor);
	button.setForeground(foregroundColor);
	button.setBorderPainted(false);
	button.setFocusPainted(false);
	button.setHorizontalTextPosition(SwingConstants.CENTER);
	button.setVerticalTextPosition(SwingConstants.BOTTOM);
	button.setFont(font);
	button.setMargin(new Insets(2, 16, 2, 16));
	button.setOpaque(true);
	button.setDoubleBuffered(true);
	button.setRolloverEnabled(true);
	return button;
}
 
Example 13
Source File: BrowserAddonDlg.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JButton createButton1(String name, int x, int y) {
	JButton btn = new CustomButton(StringResource.get(name));
	btn.setBackground(ColorResource.getDarkBtnColor());
	btn.setBorderPainted(false);
	btn.setFocusPainted(false);
	btn.setForeground(Color.WHITE);
	btn.setFont(FontResource.getNormalFont());
	Dimension d = btn.getPreferredSize();
	btn.setBounds(x, y, d.width, d.height);
	btn.addActionListener(this);
	return btn;
}
 
Example 14
Source File: MButtonTabComponent.java    From javamelody with Apache License 2.0 5 votes vote down vote up
@Override
public void mouseEntered(MouseEvent e) {
	final Component component = e.getComponent();
	if (component instanceof JButton) {
		final JButton button = (JButton) component;
		button.setBorderPainted(true);
	}
}
 
Example 15
Source File: IOObjectCacheEntryPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new {@link IOObjectCacheEntryPanel}.
 *
 * @param icon
 *            The {@link Icon} associated with the entry's type.
 * @param entryType
 *            Human readable representation of the entry's type (e.g., 'Data Table').
 * @param openAction
 *            The action to be performed when clicking in the entry.
 * @param removeAction
 *            An action triggering the removal of the entry.
 */
public IOObjectCacheEntryPanel(Icon icon, String entryType, Action openAction, Action removeAction) {
	super(ENTRY_LAYOUT);

	this.openAction = openAction;

	// add icon label
	JLabel iconLabel = new JLabel(icon);
	add(iconLabel, ICON_CONSTRAINTS);

	// add object type label
	JLabel typeLabel = new JLabel(entryType);
	typeLabel.setMaximumSize(new Dimension(MAX_TYPE_WIDTH, 24));
	typeLabel.setPreferredSize(typeLabel.getMaximumSize());
	typeLabel.setToolTipText(entryType);
	add(typeLabel, TYPE_CONSTRAINTS);

	// add link button performing the specified action, the label displays the entry's key name
	LinkLocalButton openButton = new LinkLocalButton(openAction);
	openButton.setMargin(new Insets(0, 0, 0, 0));
	add(openButton, KEY_CONSTRAINTS);

	// add removal button
	JButton removeButton = new JButton(removeAction);
	removeButton.setBorderPainted(false);
	removeButton.setOpaque(false);
	removeButton.setMinimumSize(buttonSize);
	removeButton.setPreferredSize(buttonSize);
	removeButton.setContentAreaFilled(false);
	removeButton.setText(null);
	add(removeButton, REMOVE_BUTTON_CONSTRAINTS);

	// register mouse listeners
	addMouseListener(hoverMouseListener);
	iconLabel.addMouseListener(dispatchMouseListener);
	typeLabel.addMouseListener(dispatchMouseListener);
	openButton.addMouseListener(dispatchMouseListener);
	removeButton.addMouseListener(dispatchMouseListener);
}
 
Example 16
Source File: BeltColumnStatisticsPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Updates the charts.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
	for (int i = 0; i < listOfChartPanels.size(); i++) {
		JPanel panel = listOfChartPanels.get(i);
		panel.removeAll();
		JFreeChart chartOrNull = getModel().getChartOrNull(i);
		if (chartOrNull != null) {
			final ChartPanel chartPanel = new ChartPanel(chartOrNull) {

				private static final long serialVersionUID = -6953213567063104487L;

				@Override
				public Dimension getPreferredSize() {
					return DIMENSION_CHART_PANEL_ENLARGED;
				}
			};
			chartPanel.setPopupMenu(null);
			chartPanel.setBackground(COLOR_TRANSPARENT);
			chartPanel.setOpaque(false);
			chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
			panel.add(chartPanel, BorderLayout.CENTER);

			JPanel openChartPanel = new JPanel(new GridBagLayout());
			openChartPanel.setOpaque(false);

			GridBagConstraints gbc = new GridBagConstraints();
			gbc.anchor = GridBagConstraints.CENTER;
			gbc.fill = GridBagConstraints.NONE;
			gbc.weightx = 1.0;
			gbc.weighty = 1.0;

			JButton openChartButton = new JButton(OPEN_CHART_ACTION);
			openChartButton.setOpaque(false);
			openChartButton.setContentAreaFilled(false);
			openChartButton.setBorderPainted(false);
			openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
			openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
			openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
			openChartButton.setIcon(null);
			Font font = openChartButton.getFont();
			Map attributes = font.getAttributes();
			attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
			openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

			openChartPanel.add(openChartButton, gbc);

			panel.add(openChartPanel, BorderLayout.SOUTH);
		}
		panel.revalidate();
		panel.repaint();
	}
}
 
Example 17
Source File: BrowserAddonDlg.java    From xdm with GNU General Public License v2.0 4 votes vote down vote up
private void initUI() {
	setUndecorated(true);

	try {
		if (GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
				.isWindowTranslucencySupported(WindowTranslucency.TRANSLUCENT)) {
			if (!Config.getInstance().isNoTransparency()) {
				setOpacity(0.85f);
			}
		}
	} catch (Exception e) {
		Logger.log(e);
	}

	setIconImage(ImageResource.getImage("icon.png"));
	setSize(getScaledInt(400), getScaledInt(300));
	setLocationRelativeTo(null);
	setAlwaysOnTop(true);
	getContentPane().setLayout(null);
	getContentPane().setBackground(ColorResource.getDarkestBgColor());

	JPanel titlePanel = new TitlePanel(null, this);
	titlePanel.setOpaque(false);
	titlePanel.setBounds(0, 0, getScaledInt(400), getScaledInt(50));

	JButton closeBtn = new CustomButton();
	closeBtn.setBounds(getScaledInt(365), getScaledInt(5), getScaledInt(30), getScaledInt(30));
	closeBtn.setBackground(ColorResource.getDarkestBgColor());
	closeBtn.setBorderPainted(false);
	closeBtn.setFocusPainted(false);
	closeBtn.setName("CLOSE");

	closeBtn.setIcon(ImageResource.getIcon("title_close.png", 20, 20));
	closeBtn.addActionListener(this);
	titlePanel.add(closeBtn);

	JLabel titleLbl = new JLabel(StringResource.get("BROWSER_MONITORING"));
	titleLbl.setFont(FontResource.getBiggerFont());
	titleLbl.setForeground(ColorResource.getSelectionColor());
	titleLbl.setBounds(getScaledInt(25), getScaledInt(15), getScaledInt(200), getScaledInt(30));
	titlePanel.add(titleLbl);

	JLabel lineLbl = new JLabel();
	lineLbl.setBackground(ColorResource.getSelectionColor());
	lineLbl.setBounds(0, getScaledInt(55), getScaledInt(400), 1);
	lineLbl.setOpaque(true);
	add(lineLbl);
	add(titlePanel);

	int y = getScaledInt(65);
	int h = getScaledInt(50);
	JTextArea lblMonitoringTitle = new JTextArea();
	lblMonitoringTitle.setOpaque(false);
	lblMonitoringTitle.setWrapStyleWord(true);
	lblMonitoringTitle.setLineWrap(true);
	lblMonitoringTitle.setEditable(false);
	lblMonitoringTitle.setForeground(Color.WHITE);
	lblMonitoringTitle.setText(this.desc);
	lblMonitoringTitle.setFont(FontResource.getNormalFont());
	lblMonitoringTitle.setBounds(getScaledInt(15), y, getScaledInt(370) - getScaledInt(30), h);
	add(lblMonitoringTitle);
	y += h;

	JButton btViewMonitoring = createButton1("CTX_COPY_URL", getScaledInt(15), y);
	btViewMonitoring.setName("COPY");
	add(btViewMonitoring);
	y += btViewMonitoring.getHeight();

}
 
Example 18
Source File: AttributeStatisticsPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Updates the charts.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
private void updateCharts() {
	for (int i = 0; i < listOfChartPanels.size(); i++) {
		JPanel panel = listOfChartPanels.get(i);
		panel.removeAll();
		final ChartPanel chartPanel = new ChartPanel(getModel().getChartOrNull(i)) {

			private static final long serialVersionUID = -6953213567063104487L;

			@Override
			public Dimension getPreferredSize() {
				return DIMENSION_CHART_PANEL_ENLARGED;
			}
		};
		chartPanel.setPopupMenu(null);
		chartPanel.setBackground(COLOR_TRANSPARENT);
		chartPanel.setOpaque(false);
		chartPanel.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
		panel.add(chartPanel, BorderLayout.CENTER);

		JPanel openChartPanel = new JPanel(new GridBagLayout());
		openChartPanel.setOpaque(false);

		GridBagConstraints gbc = new GridBagConstraints();
		gbc.anchor = GridBagConstraints.CENTER;
		gbc.fill = GridBagConstraints.NONE;
		gbc.weightx = 1.0;
		gbc.weighty = 1.0;

		JButton openChartButton = new JButton(OPEN_CHART_ACTION);
		openChartButton.setOpaque(false);
		openChartButton.setContentAreaFilled(false);
		openChartButton.setBorderPainted(false);
		openChartButton.addMouseListener(enlargeAndHoverAndPopupMouseAdapter);
		openChartButton.setHorizontalAlignment(SwingConstants.LEFT);
		openChartButton.setHorizontalTextPosition(SwingConstants.LEFT);
		openChartButton.setIcon(null);
		Font font = openChartButton.getFont();
		Map attributes = font.getAttributes();
		attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
		openChartButton.setFont(font.deriveFont(attributes).deriveFont(10.0f));

		openChartPanel.add(openChartButton, gbc);

		panel.add(openChartPanel, BorderLayout.SOUTH);
		panel.revalidate();
		panel.repaint();
	}
}
 
Example 19
Source File: WelcomePane.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
private JPanel createButtonsPane() {
  final int buttonPaneHeight = backgroundImage.getHeight( null );
  final JPanel buttonPane = new JPanel();
  buttonPane.setLayout( null );
  buttonPane.setOpaque( false );
  buttonPane.setBackground( new Color( 0, 0, 0, 0 ) );
  buttonPane.setBorder( new EmptyBorder( 0, 0, 0, 0 ) );
  buttonPane.setMinimumSize( new Dimension( 514, buttonPaneHeight ) );
  buttonPane.setMaximumSize( new Dimension( 514, buttonPaneHeight ) );
  buttonPane.setPreferredSize( new Dimension( 514, buttonPaneHeight ) );

  try {
    final Class wizardClass =
      Class.forName( "org.pentaho.reporting.designer.extensions.wizard.NewWizardReportAction" );
    final AbstractDesignerContextAction newWizardActionListener =
      (AbstractDesignerContextAction) wizardClass.newInstance();
    newWizardActionListener.setReportDesignerContext( reportDesignerContext );
    final JButton wizardBtn = new TransparentButton();
    wizardBtn.addActionListener( newWizardActionListener );
    wizardBtn.addActionListener( closeActionListener );
    wizardBtn.setBorderPainted( true );
    wizardBtn.setBounds( 117, 137, 100, 118 );
    buttonPane.add( wizardBtn );

    final JLabel wizardLabel =
      new JLabel( newWizardActionListener.getValue( "WIZARD.BUTTON.TEXT" ).toString(), JLabel.CENTER ); //NON-NLS
    wizardLabel.setBounds( 80, 273, 165, 56 );
    buttonPane.add( wizardLabel );

    final JButton wizardLabelBtn = new TransparentButton();
    wizardLabelBtn.addActionListener( newWizardActionListener );
    wizardLabelBtn.addActionListener( closeActionListener );
    wizardLabelBtn.setBorderPainted( true );
    wizardLabelBtn.setBounds( 80, 273, 165, 56 );
    buttonPane.add( wizardLabelBtn );
  } catch ( Exception e ) {
    // todo: Remove me. Replace the code with a real extension mechanism
  }

  // Adds the new (blank) report button
  final JButton newReportBtn = new TransparentButton();
  newReportBtn.addActionListener( newReportAction );
  newReportBtn.addActionListener( closeActionListener );
  newReportBtn.setBorderPainted( true );
  newReportBtn.setBounds( 323, 137, 100, 118 );
  buttonPane.add( newReportBtn );

  final JLabel newReportLabel = new JLabel( Messages.getString( "WelcomePane.newReportLabel" ), JLabel.CENTER );
  newReportLabel.setBounds( 285, 273, 165, 56 );
  buttonPane.add( newReportLabel );

  final JButton newReportLabelBtn = new TransparentButton();
  newReportLabelBtn.addActionListener( newReportAction );
  newReportLabelBtn.addActionListener( closeActionListener );
  newReportLabelBtn.setBorderPainted( true );
  newReportLabelBtn.setBounds( 285, 273, 165, 56 );
  buttonPane.add( newReportLabelBtn );
  return buttonPane;
}
 
Example 20
Source File: ClassPresenterPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initComponents() {
    Color borderColor = UIManager.getLookAndFeel().getID().equals("Metal") ? // NOI18N
        UIManager.getColor("Button.darkShadow") : UIManager.getColor("Button.shadow"); // NOI18N
    setBorder(BorderFactory.createCompoundBorder(
        BorderFactory.createLineBorder(borderColor), BorderFactory.createEmptyBorder(2, 5, 2, 5)));
    setOpaque(true);
    setBackground(UIUtils.getDarker(UIUtils.getProfilerResultsBackground()));

    headerRenderer = new HeaderRenderer();
    headerRenderer.setIcon(ICON_CLASS);
    headerRenderer.setForeground(UIManager.getColor("ToolTip.foreground")); // NOI18N
    headerRenderer.setFont(UIManager.getFont("ToolTip.font")); // NOI18N
    headerRenderer.setOpaque(false);

    detailsRenderer = new JLabel();
    detailsRenderer.setForeground(UIManager.getColor("ToolTip.foreground")); // NOI18N
    detailsRenderer.setFont(UIManager.getFont("ToolTip.font")); // NOI18N
    detailsRenderer.setOpaque(false);
    
    actionsDivider = new JLabel("  |  "); // NOI18N
    actionsDivider.setForeground(UIManager.getColor("ToolTip.foreground")); // NOI18N
    actionsDivider.setFont(UIManager.getFont("ToolTip.font")); // NOI18N
    actionsDivider.setOpaque(false);

    actionsRenderer = new JButton() {
        protected void fireActionPerformed(ActionEvent e) {
            if (heapFragmentWalker != null) {
                BrowserUtils.performTask(new Runnable() {
                    public void run() {
                        heapFragmentWalker.computeRetainedSizes(true, true);
                    }
                });
            }
        }
        public Dimension getMinimumSize() {
            return getPreferredSize();
        }
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
        public void setVisible(boolean visible) {
            super.setVisible(visible);
            actionsDivider.setVisible(visible);
        }
        public boolean isContentAreaFilled() {
            return !UIUtils.isOracleLookAndFeel() ? false : isFocusOwner();
        }
        public boolean isOpaque() {
            return !UIUtils.isOracleLookAndFeel() ? false : isFocusOwner();
        }
    };
    actionsRenderer.setOpaque(false);
    actionsRenderer.setContentAreaFilled(false);
    actionsRenderer.setBorderPainted(true);
    actionsRenderer.setMargin(new Insets(0, 0, 0, 0));
    actionsRenderer.setBorder(BorderFactory.createEmptyBorder());
    actionsRenderer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    actionsRenderer.setFont(UIManager.getFont("ToolTip.font")); // NOI18N
    actionsRenderer.setText("<html><nobr><a href='#'>" + Bundle.ClassPresenterPanel_RetainedSizesString() + "</a></nobr></html>"); // NOI18N
    actionsRenderer.setVisible(false);

    JPanel detailsContainer = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
    detailsContainer.setOpaque(false);
    detailsContainer.add(detailsRenderer);
    detailsContainer.add(actionsDivider);
    detailsContainer.add(actionsRenderer);
    
    setLayout(new GridBagLayout());
    
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    add(headerRenderer, c);
    
    JPanel filler = new JPanel(null);
    filler.setOpaque(false);
    c = new GridBagConstraints();
    c.gridx = 1;
    c.weightx = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    add(filler, c);
    
    c = new GridBagConstraints();
    c.gridx = 2;
    add(detailsContainer, c);
}