package jbPack; import javax.swing.*; import java.awt.*; import java.util.*; import java.io.*; class GuiAWT extends Frame { GuiAWT(String [] args) { super("Prosty edytor"); String styl = "Dialog"; int rozmiar = 14; int r1 = 255, g1 = 255, b1 = 255; int r2 = 0, g2 = 0, b2 = 255; if(args.length == 8){ if( args[0].equals("Dialog") || args[0].equals("Serif") || args[0].equals("Monospaced")){ styl = args[0]; } try{ rozmiar = Integer.parseInt(args[1]); } catch ( NumberFormatException ex){ rozmiar = 14; } if(rozmiar < 8) rozmiar = 14; try{ r1 = Integer.parseInt(args[2]); if(r1 < 0 || r1 > 255) r1 = 255; } catch ( NumberFormatException ex) { r1=255 ; } try{ g1 = Integer.parseInt(args[3]); if(g1 < 0 || g1 > 255) g1 = 255; } catch ( NumberFormatException ex) { g1 = 255; } try { b1 = Integer.parseInt(args[4]); if(b1 < 0 || b1 > 255) b1 = 255; } catch ( NumberFormatException ex) { b1 = 255; } try{ r2 = Integer.parseInt(args[5]); if(r2 < 0 || r2 > 255) r2 = 0; } catch ( NumberFormatException ex) { r2 = 0; } try{ g2 = Integer.parseInt(args[6]); if(g2 < 0 || g2 > 255) g2 = 0; } catch ( NumberFormatException ex) { g2 = 0; } try{ b2 = Integer.parseInt(args[7]); if(b2 < 0 || b2 > 255) b2 = 255; } catch ( NumberFormatException ex) { b2 = 255; } } setLayout(new FlowLayout()); TextArea ta = new TextArea(); ta.setFont(new Font(styl, Font.PLAIN, rozmiar )); ta.setForeground(new Color(r1, g1, b1)); ta.setBackground(new Color(r2, g2, b2)); add(ta); pack(); show(); } public static void main(String[] args) { // w metodzie main tworzymy //obiekt naszej klasy // i wywołujemy konstruktor new GuiAWT(args); } }