Advertisement
NotATowel

Untitled

Sep 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. /**
  2. Name: Brandon Altuchow
  3. ID: 0207256
  4. Date: 9/23/17
  5. Description: Journal 6C - Fonts & Colors
  6.  */
  7. package journal6c;
  8. import javax.swing.*;
  9. import java.awt.*;
  10.  
  11. public class Journal6C extends JFrame{
  12.     Container content = this.getContentPane();
  13.     JLabel lbl = new JLabel("Brandon");
  14.     JLabel lbl2 = new JLabel("Altuchow");
  15.     JLabel lbl3 = new JLabel("9/23/17");
  16.     Font fnt = new Font("serif", Font.BOLD, 36);
  17.     Font fnt2 = new Font("sansserif", Font.PLAIN, 36);
  18.     Font fnt3 = new Font("monospaced", Font.ITALIC, 36);
  19.     Color foreClr = new Color(1.0F, .49F, .25F);
  20.     Color foreClr2 = new Color(255,255,255);
  21.  
  22.            
  23.     public Journal6C(){
  24.         content.setLayout(new FlowLayout());
  25.         content.add(lbl);
  26.         lbl.setFont(fnt);
  27.         lbl.setForeground(foreClr);
  28.         lbl.setBackground(Color.BLUE);
  29.         lbl.setOpaque(true);
  30.         content.add(lbl2);
  31.         lbl2.setFont(fnt2);
  32.         lbl2.setForeground(foreClr2);
  33.         lbl2.setBackground(Color.BLACK);
  34.         lbl2.setOpaque(true);
  35.         content.add(lbl3);
  36.         lbl3.setFont(fnt3);
  37.         lbl3.setForeground(Color.YELLOW);
  38.         lbl3.setBackground(Color.RED);
  39.         lbl3.setOpaque(true);
  40.        
  41.         this.setVisible(true);
  42.         this.setSize(300,400);
  43.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  44.         this.setTitle("Gui App");
  45.     }
  46.     public static void main(String[] args) {
  47.         Journal6C gui = new Journal6C();
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement