Java Code Examples for javax.swing.JSeparator#setForeground()

The following examples show how to use javax.swing.JSeparator#setForeground() . 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: PersistenceProviderComboboxHelper.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    
    if (isSelected) {
        setBackground(list.getSelectionBackground());
        setForeground(list.getSelectionForeground());
    } else {
        setBackground(list.getBackground());
        setForeground(list.getForeground());
    }
    
    if (value instanceof Provider) {
        Provider provider = (Provider)value;
        String text = provider.getDisplayName();
        if (value.equals(defaultProvider) && (!(value instanceof DefaultProvider))) {
            text += NbBundle.getMessage(PersistenceProviderComboboxHelper.class, "LBL_DEFAULT_PROVIDER");
        }
        setText(text);
        
    } else if (SEPARATOR.equals(value)) {
        JSeparator s = new JSeparator();
        s.setPreferredSize(new Dimension(s.getWidth(), 1));
        s.setForeground(Color.BLACK);
        return s;
        
    } else if (EMPTY.equals(value)) {
        setText(" ");
        
    } else if (value instanceof LibraryItem) {
        setText(((LibraryItem) value).getText());
        
    } else {
        setText(value != null ?  value.toString() : ""); // NOI18N
    }
    
    return this;
}
 
Example 2
Source File: ToolbarContainer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ToolbarAqua() {
    super( new BorderLayout() );
    JSeparator sep = new JToolBar.Separator();
    sep.setOrientation(JSeparator.VERTICAL);
    sep.setForeground(UIManager.getColor("NbSplitPane.background")); //NOI18N
    add( sep, BorderLayout.CENTER );
    dim = new Dimension (GRIP_WIDTH, GRIP_WIDTH);
    max = new Dimension (GRIP_WIDTH, Integer.MAX_VALUE);
    setBorder(BorderFactory.createEmptyBorder(4, 0, 2, 0));
}
 
Example 3
Source File: ReservedCheckinWindow.java    From Hotel-Properties-Management-System with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the dialog.
 */
public ReservedCheckinWindow(Room roomNumber) {

	this.ownInjectedRoom = roomNumber;
	
	loggingEngine = LoggingEngine.getInstance();
	loggingEngine.setMessage("User is : " + sessionBean.getNickName());
	
	setMinimumSize(new Dimension(750, 495));
	setPreferredSize(new Dimension(750, 495));
	setLocationRelativeTo(null);

	this.setIconImage(Toolkit.getDefaultToolkit().
			getImage(getClass().getResource(LOGOPATH)));

	getContentPane().setForeground(new Color(255, 99, 71));
	getContentPane().setFocusCycleRoot(true);
	getContentPane().setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
	getContentPane().setFont(new Font("Verdana", Font.BOLD, 12));
	setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	setModal(true);
	setResizable(false);

	this.setTitle("Coder HPMSA - [Checkin]");
	contentPanel.setAutoscrolls(true);
	contentPanel.setPreferredSize(new Dimension(10, 415));

	contentPanel.setBackground(Color.decode("#066d95"));
	contentPanel.setLayout(new BorderLayout(0, 0));
	getContentPane().add(contentPanel, BorderLayout.SOUTH);

	upperPanel = new JPanel();
	upperPanel.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	upperPanel.setBackground(new Color(135, 206, 235));
	upperPanel.setPreferredSize(new Dimension(10, 35));
	contentPanel.add(upperPanel, BorderLayout.NORTH);

	JLabel lblChangeRoomPerson = new JLabel("Change person count : ");
	lblChangeRoomPerson.setFont(new Font("Arial", Font.PLAIN, 15));
	upperPanel.add(lblChangeRoomPerson);

	spinner = new JSpinner();
	spinner.setModel(new SpinnerNumberModel(1, 1, 3, 1));
	spinner.setPreferredSize(new Dimension(40, 20));
	spinner.setMinimumSize(new Dimension(35, 20));
	spinner.addChangeListener(customerCounterListener());
	upperPanel.add(spinner);

	JPanel buttonPanel = new JPanel();
	buttonPanel.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null));
	buttonPanel.setPreferredSize(new Dimension(10, 50));
	buttonPanel.setLayout(null);
	getContentPane().add(buttonPanel, BorderLayout.NORTH);

	JButton roomCheckinBtn = new JButton("Room checkin");
	roomCheckinBtn.addActionListener(this);
	roomCheckinBtn.setIcon(new ImageIcon(ReservedCheckinWindow.class
					.getResource("/com/coder/hms/icons/extra_checkin.png")));
	roomCheckinBtn.setBounds(7, 4, 130, 42);
	buttonPanel.add(roomCheckinBtn);

	final JSeparator separator = new JSeparator();
	separator.setBackground(Color.DARK_GRAY);
	separator.setBounds(149, 6, 10, 36);
	separator.setOrientation(SwingConstants.VERTICAL);
	separator.setFocusable(true);
	separator.setForeground(Color.DARK_GRAY);
	separator.setAutoscrolls(true);
	separator.setPreferredSize(new Dimension(10, 20));
	buttonPanel.add(separator);

	JLabel lblRoom = new JLabel("ROOM : ");
	lblRoom.setFont(new Font("Verdana", Font.BOLD, 15));
	lblRoom.setBounds(330, 8, 68, 33);
	buttonPanel.add(lblRoom);

	JLabel roomNumberLbl = new JLabel(ownInjectedRoom.getNumber());
	roomNumberLbl.setForeground(new Color(220, 20, 60));
	roomNumberLbl.setFont(new Font("Verdana", Font.BOLD, 17));
	roomNumberLbl.setBounds(406, 8, 103, 33);
	buttonPanel.add(roomNumberLbl);
	
	contentPanel.add(customerFormOne.setCustomerDetailPanel(), BorderLayout.WEST);
	prepareCustomerForms(ownInjectedRoom.getNumber());

}
 
Example 4
Source File: PreferencePanel.java    From pumpernickel with MIT License 4 votes vote down vote up
private void layoutHomePanel() {
	if (rows.size() <= 1) {
		return;
	}

	homePanel.removeAll();

	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0;
	c.gridy = 0;

	for (int a = 0; a < rows.size(); a++) {
		Row row = rows.get(a);
		JPanel rowBackground = new JPanel();
		rowBackground.setOpaque(true);
		if (a % 2 == 0) {
			rowBackground.setBackground(color1);
		} else {
			rowBackground.setBackground(color2);
		}

		c.gridheight = 1;
		c.insets = labelInsets;
		homePanel.add(row.label, c);
		c.gridy++;

		c.gridwidth = 1;
		c.insets = buttonInsets;
		c.anchor = GridBagConstraints.CENTER;
		c.fill = GridBagConstraints.NONE;
		c.weightx = 0;
		for (int b = 0; b < row.buttons.length; b++) {
			c.gridx = b;
			homePanel.add(row.buttons[b], c);
			row.buttons[b].setSelected(false);
		}
		JPanel fluff = new JPanel();
		fluff.setOpaque(false);
		c.gridx = row.buttons.length;
		c.weightx = 1;
		c.insets = new Insets(0, 0, 0, 0);
		homePanel.add(fluff, c);

		c.gridx = 0;
		c.gridy--;

		c.weightx = 1;
		c.fill = GridBagConstraints.BOTH;
		c.gridwidth = GridBagConstraints.REMAINDER;
		c.gridheight = 2;
		homePanel.add(rowBackground, c);

		c.gridx = 0;
		c.gridy += 2;
		if (a < rows.size() - 1) {
			c.gridwidth = GridBagConstraints.REMAINDER;
			JSeparator newSeparator = new JSeparator();
			newSeparator.setUI(new HairSeparatorUI());
			newSeparator.setForeground(new Color(212, 212, 212));
			c.weighty = 0;
			homePanel.add(newSeparator, c);
			c.weighty = 1;
			c.gridy++;
		}
	}

	Dimension prefSize = homePanel.getPreferredSize();
	maxContentSize.width = Math.max(prefSize.width, maxContentSize.width);
	maxContentSize.height = Math
			.max(prefSize.height, maxContentSize.height);
}
 
Example 5
Source File: MessagePanel.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
MessagePanel(@Nullable final Image icon, @Nullable final String title, @Nonnull final Color background, @Nonnull final JComponent component) {
  super(new GridBagLayout());
  this.setBackground(background);
  this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.BLACK), BorderFactory.createEmptyBorder(8, 8, 8, 8)));

  final GridBagConstraints constraints = new GridBagConstraints();

  final JLabel labelTitle = new JLabel(title == null ? "" : title, icon == null ? null : new ImageIcon(icon),SwingConstants.CENTER); //NOI18N
  labelTitle.setForeground(Color.black);
  constraints.gridx = 0;
  constraints.gridy = 0;
  constraints.gridwidth = 1;
  constraints.gridheight = 1;
  constraints.weightx = 1000;
  constraints.fill = GridBagConstraints.BOTH;
  constraints.anchor = GridBagConstraints.NORTHWEST;
  
  labelTitle.setFont(labelTitle.getFont().deriveFont(Font.BOLD));
  
  this.add(labelTitle, constraints);

  constraints.gridx = 1;
  constraints.gridy = 0;

  final JButton closeButton = new JButton(NIMBUS_CLOSE_ICON);
  closeButton.addActionListener(this);
  closeButton.setBorder(null);
  closeButton.setContentAreaFilled(false);
  closeButton.setMargin(new Insets(0, 0, 0, 0));
  closeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  closeButton.setOpaque(false);

  constraints.weightx = 1;
  
  this.add(closeButton, constraints);

  constraints.gridx = 0;
  constraints.gridy = 1;

  constraints.gridwidth = 2;
  constraints.weightx = 1;

  final JSeparator separator = new JSeparator(JSeparator.HORIZONTAL);
  separator.setForeground(Color.DARK_GRAY);
  this.add(separator, constraints);
  
  constraints.gridx = 0;
  constraints.gridy = 2;
  constraints.weightx = 1000;
  constraints.weighty = 1000;

  this.add(component, constraints);

  this.setAlignmentY(Component.RIGHT_ALIGNMENT);
  
  doLayout();

  ACTIVE_MESSAGES.incrementAndGet();
}