Java Code Examples for java.awt.Label#setForeground()

The following examples show how to use java.awt.Label#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: PropertiesDisplay.java    From RobotBuilder with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public PropertiesDisplay() {
    setLayout(new BorderLayout());
    errorLabel = new Label("Error: Hover over the red property names for details of how to fix.");
    errorLabel.setForeground(Color.red);
    errorLabel.setVisible(false);
    add(errorLabel, BorderLayout.NORTH);
    propTableModel = new PropertiesTableModel();
    propTable = new PropertiesTable(propTableModel);
    currentDisplay = new JScrollPane(propTable);
    add(currentDisplay, BorderLayout.CENTER);
    propTable.setFillsViewportHeight(true);
    propTable.getTableHeader().setReorderingAllowed(false);
}
 
Example 2
Source File: Sage.java    From sagetv with Apache License 2.0 5 votes vote down vote up
private static void splashAndLicense()
{
  splashWindow = new Window(masterWindow);
  splashWindow.setLayout(new BorderLayout());
  Image theImage = null;
  String splashImageName;
  if (Sage.get("ui/splash_image", null) != null)
  {
    theImage = Toolkit.getDefaultToolkit().createImage(Sage.get("ui/splash_image", null));
    ImageUtils.ensureImageIsLoaded(theImage);
  }
  else
  {
    theImage = ImageUtils.fullyLoadImage(isTrueClient() ? (is64BitJVM() ? "images/splashclient64.gif" : "images/splashclient.gif") : 
                                                          (is64BitJVM() ? "images/splash64.gif"       : "images/splash.gif"      ));
  }
  ActiveImage splashImage = new ActiveImage(theImage);
  splashWindow.add(splashImage, "Center");
  splashText = new Label(Sage.rez("Module_Init", new Object[] { "Application" }), Label.CENTER)
  {
    public void paint(Graphics g)
    {
      super.paint(g);
      g.setColor(Color.black);
      g.drawRect(0, 0, getWidth()-1, getHeight()-1);
    }
  };
  splashText.setBackground(new Color(42, 103, 190));
  splashText.setForeground(Color.white);
  splashWindow.add(splashText, "South");
  Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();
  splashWindow.pack();
  Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
  splashWindow.setLocation(center.x - splashWindow.getWidth()/2, center.y - splashWindow.getHeight()/2);
  splashWindow.setVisible(true);
}
 
Example 3
Source File: InteractivePlotter.java    From Scripts with GNU General Public License v3.0 5 votes vote down vote up
private void updatePromptLabel(final int index, final String newLabel, final Color color) {
	try {
		synchronized (prompt.getTreeLock()) {
			final Label label = ((Label) prompt.getComponent(index));
			label.setAlignment(Label.RIGHT);
			label.setText(newLabel);
			label.setForeground(color);
		}
	} catch (final ArrayIndexOutOfBoundsException | ClassCastException ignored) {
		// Do nothing: index is not valid
	}
}
 
Example 4
Source File: PluginConfigurationTab.java    From burp-javascript-security-extension with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Render the view
 */
public void render() {
	SpringLayout layout = new SpringLayout();
	setLayout(layout);
       titleLabel = new Label("DOM Check Settings");
	titleLabel.setForeground(new Color(229, 137, 0));
	titleLabel.setFont(new Font("Dialog", Font.BOLD, 15));
	layout.putConstraint(SpringLayout.NORTH, titleLabel, 5, SpringLayout.NORTH, getInstance());
	layout.putConstraint(SpringLayout.WEST, titleLabel, 5, SpringLayout.WEST, getInstance());

	// Driver chooser wiring
	driverChooser = new JFileChooser();

	// Try to set a default based on a standard. Linux install location
	if (extensionCallbacks.loadExtensionSetting(SETTING_CHROMEDRIVER_PATH) != null){
		File settingDriverPath = new File(extensionCallbacks.loadExtensionSetting(SETTING_CHROMEDRIVER_PATH));
		driverChooser.setSelectedFile(settingDriverPath);
	} else {
		File defaultDriver = new File("/usr/lib/chromium-browser/chromedriver");
		driverChooser.setSelectedFile(defaultDriver);
	}

	driverChooserLabel = new JLabel("Select the chromedriver to use:");
	layout.putConstraint(SpringLayout.NORTH, driverChooserLabel, 5, SpringLayout.SOUTH, titleLabel);
	layout.putConstraint(SpringLayout.WEST, driverChooserLabel, 5, SpringLayout.WEST, getInstance());

	filePathField = new JTextField(getDriverPath());
	filePathField.setColumns(MAX_FILE_FIELD_COLS);
	filePathField.setEditable(false);
	layout.putConstraint(SpringLayout.WEST, filePathField, 5, SpringLayout.EAST, driverChooserLabel);
	layout.putConstraint(SpringLayout.NORTH, filePathField, 5, SpringLayout.SOUTH, titleLabel);

	openChooserButton = new JButton("Select Driver...");
	openChooserButton.addActionListener(this);
	layout.putConstraint(SpringLayout.WEST, openChooserButton, 5, SpringLayout.WEST, getInstance());
	layout.putConstraint(SpringLayout.NORTH, openChooserButton, 5, SpringLayout.SOUTH, driverChooserLabel);

	// Delay wiring
	delayLabel = new JLabel("Delay (in seconds) to wait for the DOM to load:");
	layout.putConstraint(SpringLayout.WEST, delayLabel, 5, SpringLayout.WEST, getInstance());
	layout.putConstraint(SpringLayout.NORTH, delayLabel, 20, SpringLayout.SOUTH, openChooserButton);

	delayTextField = new JTextField(defaultDelay.toString());
	delayTextField.setColumns(MAX_DELAY_COLS);
	layout.putConstraint(SpringLayout.WEST, delayTextField, 5, SpringLayout.EAST, delayLabel);
	layout.putConstraint(SpringLayout.NORTH, delayTextField, 20, SpringLayout.SOUTH, openChooserButton);

	// IoC wiring
	iocLabel = new Label("IoC Count: ");
	layout.putConstraint(SpringLayout.WEST, iocLabel, 5, SpringLayout.WEST, getInstance());
	layout.putConstraint(SpringLayout.NORTH, iocLabel, 20, SpringLayout.SOUTH, delayLabel);
	iocCountField = new JTextField(myIocChecker.getIocCount().toString());
	iocCountField.setColumns(MAX_IOC_FIELD_COLS);
	iocCountField.setEditable(false);
	layout.putConstraint(SpringLayout.WEST, iocCountField, 5, SpringLayout.EAST, iocLabel);
	layout.putConstraint(SpringLayout.NORTH, iocCountField, 20, SpringLayout.SOUTH, delayLabel);
	iocChooser = new JFileChooser();
	openIocFileButton = new JButton("Import IoCs");
	openIocFileButton.addActionListener(this);
	layout.putConstraint(SpringLayout.WEST, openIocFileButton, 5, SpringLayout.EAST, iocCountField);
	layout.putConstraint(SpringLayout.NORTH, openIocFileButton, 20, SpringLayout.SOUTH, delayLabel);


	// add to Pane
	add(titleLabel);
	add(driverChooserLabel);
	add(filePathField);
	add(openChooserButton);
	add(delayLabel);
	add(delayTextField);
	add(iocLabel);
	add(iocCountField);
	add(openIocFileButton);
}
 
Example 5
Source File: Merge_Cluster_Jobs.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
protected void update( final Label label )
{
	label.setText( this.message );
	label.setForeground( this.color );
}