List of usage examples for java.awt Label setFont
public void setFont(Font f)
From source file:ExposedInt.java
public void init() { Panel buttonPanel = new PanelWithInsets(0, 0, 0, 0); buttonPanel.setLayout(new GridLayout(3, 2, 5, 5)); buttonPanel.add(new GrayButton(ExposedIntStringTable.increment)); buttonPanel.add(new GrayButton(ExposedIntStringTable.decrement)); buttonPanel.add(minimumButton);/* w ww . jav a 2 s.com*/ buttonPanel.add(maximumButton); buttonPanel.add(zeroButton); buttonPanel.add(new GrayButton(ExposedIntStringTable.negate)); zeroButton.disable(); binaryField = new Label("00000000000000000000000000000000"); hexField = new Label("00000000"); decimalField = new Label("0"); Font fieldFont = new Font("TimesRoman", Font.PLAIN, 12); binaryField.setFont(fieldFont); hexField.setFont(fieldFont); decimalField.setFont(fieldFont); Panel numberPanel = new Panel(); numberPanel.setBackground(Color.white); numberPanel.setLayout(new GridLayout(3, 1)); Panel binaryPanel = new Panel(); binaryPanel.setLayout(new BorderLayout()); binaryPanel.add("Center", binaryField); numberPanel.add(binaryPanel); Panel hexPanel = new Panel(); hexPanel.setLayout(new BorderLayout()); hexPanel.add("Center", hexField); numberPanel.add(hexPanel); numberPanel.add(decimalField); Panel labelPanel = new Panel(); labelPanel.setBackground(Color.white); labelPanel.setLayout(new GridLayout(3, 1)); Label label = new Label(ExposedIntStringTable.binary, Label.CENTER); Font labelFont = new Font("Helvetica", Font.ITALIC, 11); label.setFont(labelFont); labelPanel.add(label); label = new Label(ExposedIntStringTable.hex, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); label = new Label(ExposedIntStringTable.decimal, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); Panel dataPanel = new Panel(); dataPanel.setLayout(new BorderLayout()); dataPanel.add("West", labelPanel); dataPanel.add("Center", numberPanel); ColoredLabel title = new ColoredLabel(ExposedIntStringTable.title, Label.CENTER, Color.yellow); title.setFont(new Font("Helvetica", Font.BOLD, 12)); setBackground(Color.red); setLayout(new BorderLayout(5, 5)); add("North", title); add("West", buttonPanel); add("Center", dataPanel); }
From source file:ExposedFloat.java
public void init() { Panel buttonPanel = new PanelWithInsets(0, 0, 0, 0); buttonPanel.setLayout(new GridLayout(6, 2, 5, 5)); buttonPanel.add(maximumButton);//from w ww. java 2s. co m buttonPanel.add(minimumButton); buttonPanel.add(positiveInfinityButton); buttonPanel.add(negativeInfinityButton); buttonPanel.add(piButton); buttonPanel.add(notANumberButton); buttonPanel.add(new Button(multByZeroButtonString)); buttonPanel.add(new Button(changeSignButtonString)); buttonPanel.add(new Button(doubleButtonString)); buttonPanel.add(new Button(halveButtonString)); buttonPanel.add(new RepeaterButton(incrementButtonString)); buttonPanel.add(new RepeaterButton(decrementButtonString)); binaryField = new Label("00000000000000000000000000000000"); signField = new Label("0"); exponentField = new Label("00000000"); mantissaField = new Label("000000000000000000000000"); hexField = new Label("00000000"); base2Field = new Label("0"); base10Field = new Label("0"); Font fieldFont = new Font("TimesRoman", Font.PLAIN, 12); binaryField.setFont(fieldFont); signField.setFont(fieldFont); exponentField.setFont(fieldFont); mantissaField.setFont(fieldFont); hexField.setFont(fieldFont); base2Field.setFont(fieldFont); base10Field.setFont(fieldFont); Panel numberPanel = new Panel(); numberPanel.setBackground(Color.white); numberPanel.setLayout(new GridLayout(7, 1)); numberPanel.add(signField); numberPanel.add(exponentField); numberPanel.add(mantissaField); Panel binaryPanel = new Panel(); binaryPanel.setLayout(new BorderLayout()); binaryPanel.add("Center", binaryField); numberPanel.add(binaryPanel); Panel hexPanel = new Panel(); hexPanel.setLayout(new BorderLayout()); hexPanel.add("Center", hexField); numberPanel.add(hexPanel); numberPanel.add(base2Field); numberPanel.add(base10Field); Panel labelPanel = new Panel(); labelPanel.setBackground(Color.white); labelPanel.setLayout(new GridLayout(7, 1)); Font labelFont = new Font("Helvetica", Font.ITALIC, 11); Label label = new Label(signString, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); label = new Label(exponentString, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); label = new Label(mantissaString, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); label = new Label(binaryString, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); label = new Label(hexString, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); label = new Label(base2String, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); label = new Label(base10String, Label.CENTER); label.setFont(labelFont); labelPanel.add(label); Panel dataPanel = new Panel(); dataPanel.setLayout(new BorderLayout()); dataPanel.add("West", labelPanel); dataPanel.add("Center", numberPanel); ColoredLabel title = new ColoredLabel(titleString, Label.CENTER, Color.cyan); title.setFont(new Font("Helvetica", Font.BOLD, 12)); setBackground(Color.green); setLayout(new BorderLayout(5, 5)); add("North", title); add("West", buttonPanel); add("Center", dataPanel); }
From source file:CircleOfSquares.java
LabeledRegister(String labelText) { setLayout(new BorderLayout(5, 5)); registerContents = new ColoredLabel("00000000", Label.CENTER, Color.lightGray); registerContents.setFont(new Font("TimesRoman", Font.PLAIN, 11)); Label title = new Label(labelText, Label.RIGHT); title.setFont(new Font("Helvetica", Font.ITALIC, 11)); add("East", registerContents); add("Center", title); }
From source file:CircleOfSquares.java
RegisterPanel() { setLayout(new BorderLayout(5, 5)); pcRegister = new LabeledRegister(StringTable.pc); optopRegister = new LabeledRegister(StringTable.optop); frameRegister = new LabeledRegister(StringTable.frame); varsRegister = new LabeledRegister(StringTable.vars); setBackground(ColorTable.registersAreaColor); Panel labeledRegisterPanel = new Panel(); labeledRegisterPanel.setLayout(new GridLayout(1, 4, 5, 5)); labeledRegisterPanel.add(pcRegister); labeledRegisterPanel.add(optopRegister); labeledRegisterPanel.add(frameRegister); labeledRegisterPanel.add(varsRegister); Label title = new Label(StringTable.Registers, Label.CENTER); title.setFont(new Font("Helvetica", Font.BOLD, 11)); add("West", title); add("Center", labeledRegisterPanel); }
From source file:JVMSimulator.java
RegisterPanel() { setLayout(new BorderLayout(5, 5)); pcRegister = new LabeledRegister(StringTable.pc); optopRegister = new LabeledRegister(StringTable.optop); frameRegister = new LabeledRegister(StringTable.frame); varsRegister = new LabeledRegister(StringTable.vars); setBackground(SimData.registersAreaColor); Panel labeledRegisterPanel = new Panel(); labeledRegisterPanel.setLayout(new GridLayout(1, 4, 5, 5)); labeledRegisterPanel.add(pcRegister); labeledRegisterPanel.add(optopRegister); labeledRegisterPanel.add(frameRegister); labeledRegisterPanel.add(varsRegister); Label title = new Label(StringTable.Registers, Label.CENTER); title.setFont(new Font("Helvetica", Font.BOLD, 11)); add("West", title); add("Center", labeledRegisterPanel); }