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

The following examples show how to use java.awt.Label#setFont() . 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: AppletGameContainer.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a new panel to display the console output
 * 
 * @param e The exception causing the console to be displayed
 */
public ConsolePanel(Exception e) {
   setLayout(new BorderLayout());
   setBackground(Color.black);
   setForeground(Color.white);
   
   Font consoleFont = new Font("Arial", Font.BOLD, 14);
   
   Label slickLabel = new Label("SLICK CONSOLE", Label.CENTER);
   slickLabel.setFont(consoleFont);
   add(slickLabel, BorderLayout.PAGE_START);
   
   StringWriter sw = new StringWriter();
   e.printStackTrace(new PrintWriter(sw));
   
   textArea.setText(sw.toString());
   textArea.setEditable(false);
   add(textArea, BorderLayout.CENTER);
   
   // add a border on both sides of the console
   add(new Panel(), BorderLayout.LINE_START);
   add(new Panel(), BorderLayout.LINE_END);
   
   Panel bottomPanel = new Panel();
   bottomPanel.setLayout(new GridLayout(0, 1));
   Label infoLabel1 = new Label("An error occured while running the applet.", Label.CENTER);
   Label infoLabel2 = new Label("Plese contact support to resolve this issue.", Label.CENTER);
   infoLabel1.setFont(consoleFont);
   infoLabel2.setFont(consoleFont);
   bottomPanel.add(infoLabel1);
   bottomPanel.add(infoLabel2);
   add(bottomPanel, BorderLayout.PAGE_END);
}
 
Example 2
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 3
Source File: GHello.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 4
Source File: GHello.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 5
Source File: GHello.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 6
Source File: GHello.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 7
Source File: GHello.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 8
Source File: GHello.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 9
Source File: GHello.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 10
Source File: GHello.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 11
Source File: GHello.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 12
Source File: GHello.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 13
Source File: GHello.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 14
Source File: GHello.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
GHello() {
    Label label = new Label("Hello");
    label.setFont(new Font("Monospaced", Font.PLAIN, 144));
    add(label);
    pack();
}
 
Example 15
Source File: BigDataViewerTransformationWindow.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
public BigDataViewerTransformationWindow( final BigDataViewer bdv )
{
	this.t = new AffineTransform3D();
	final Frame frame = new Frame( "Current Global Transformation" );
	frame.setSize( 400, 200 );

	/* Instantiation */
	final GridBagLayout layout = new GridBagLayout();
	final GridBagConstraints c = new GridBagConstraints();

	final Label text1 = new Label( "1.00000   0.00000   0.00000   0.00000", Label.CENTER );
	final Label text2 = new Label( "0.00000   1.00000   0.00000   0.00000", Label.CENTER );
	final Label text3 = new Label( "0.00000   0.00000   1.00000   0.00000", Label.CENTER );

	text1.setFont( new Font( Font.MONOSPACED, Font.PLAIN, 14 ) );
	text2.setFont( new Font( Font.MONOSPACED, Font.PLAIN, 14 ) );
	text3.setFont( new Font( Font.MONOSPACED, Font.PLAIN, 14 ) );

	final Button apply = new Button( "Apply Transformation" );
	final Button cancel = new Button( "Cancel" );
	final Checkbox ignoreScale = new Checkbox( "Ignore scaling factor from BigDataViewer", ignoreScaling );

	/* Location */
	frame.setLayout( layout );

	c.fill = GridBagConstraints.HORIZONTAL;
	c.gridx = 0;
	c.gridy = 0;

	frame.add( text1, c );

	++c.gridy;
	frame.add( text2, c );

	++c.gridy;
	frame.add( text3, c );

	c.insets = new Insets( 20,0,0,0 );
	++c.gridy;
	frame.add( ignoreScale, c );

	c.insets = new Insets( 20,0,0,0 );
	++c.gridy;
	frame.add( apply, c );

	c.insets = new Insets( 0,0,0,0 );
	++c.gridy;
	frame.add( cancel, c );

	apply.addActionListener( new ApplyButtonListener( frame, bdv ) );
	cancel.addActionListener( new CancelButtonListener( frame, bdv ) );
	ignoreScale.addItemListener( new ItemListener(){ public void itemStateChanged( final ItemEvent arg0 ) { ignoreScaling = ignoreScale.getState(); } });

	frame.setVisible( true );

	timer = new Timer();
	timer.schedule( new BDVChecker( bdv, text1, text2, text3 ), 500 );
}