public Button designButton(Button b) {
   Border emptyBorder = BorderFactory.createEmptyBorder();
   b.setFocusable(false);
   b.setFont(new Font("Tahoma", Font.BOLD, 12));
   b.setForeground(Color.WHITE);
   b.setBackground(Color.DARK_GRAY);
   return b;
 }
Example #2
0
  public void init() {

    Button button1 = new Button("Button 1");
    Button button2 = new Button("Button 1");
    Button button3 = new Button("Button 1");

    Font myFont = new Font("Courier", Font.ITALIC, 12);
    button1.setFont(myFont);

    button1.setForeground(Color.black);
    button2.setForeground(Color.blue);

    button1.setBackground(Color.red);
    button2.setBackground(Color.green);

    this.add(button1);
    this.add(button2);
    this.add(button3);

    isButton1Visible = button1.isVisible();
    isButton2Visible = button2.isVisible();
  }
Example #3
0
 Panel2(web main) {
   setLayout(new GridLayout(1, 2));
   main.par = new TextArea();
   main.par.setEditable(false);
   main.par.setBackground(Color.black);
   main.par.setForeground(Color.lightGray);
   add(main.par);
   button = new Button("start");
   button.setBackground(Color.black);
   button.setForeground(Color.blue);
   button.setFont(new Font("Default", Font.PLAIN, 32));
   add(button);
   button.addActionListener(main);
 }
Example #4
0
 /** Creates new HelpBox */
 public HelpBox() {
   super(new Frame(), " Help ", false);
   this.setBackground(Color.white);
   this.setLayout(new BorderLayout());
   helpTextArea = new TextArea();
   helpTextArea.setEditable(false);
   // fill the help box
   helpTextArea.append(
       "National Institute of Standards and Technology\n"
           + "========================================\n"
           + "\n"
           + "NIST-SIP Trace viewer 1.1\n"
           + "========================================\n"
           + "\n"
           + "\n"
           + " Hit refresh  to get new trace data from the proxy. \n"
           + "If no traces appear at all, you should check if the proxy is started.\n"
           + "Once some SIP sessions are available, you can click directly on \n"
           + "an arrow representing a SIP message of your \n"
           + "choice, and see the text of the chosen SIP message. \n"
           + "If any small yellow bubbles appear on the top right of the SIP message, \n"
           + "you can click on it and see some extra informations logged by the proxy.\n"
           + "\n"
           + "\n"
           + "If you experience any problems please contact:\n"
           + "[email protected]\n"
           + "\n");
   ok = new Button(" Ok ");
   ok.setBackground(Color.lightGray);
   ok.setForeground(Color.black);
   this.add(helpTextArea, BorderLayout.CENTER);
   this.add(ok, BorderLayout.SOUTH);
   ok.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent e) {
           setVisible(false);
         }
       });
   this.addWindowListener(
       new WindowAdapter() {
         @Override
         public void windowClosing(WindowEvent e) {
           setVisible(false);
         }
       });
   // width, height
   this.setSize(400, 400);
 }
Example #5
0
 private void initcomp() {
   this.setLayout(null);
   this.setLocation(249, 135);
   this.setSize(300, 400);
   this.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
           System.exit(0);
         }
       });
   this.add(btn1);
   this.add(btn2);
   this.add(btn3);
   btn1.setBounds(50, 50, 50, 100);
   btn2.setBounds(200, 50, 50, 100);
   btn3.setBounds(50, 200, 200, 50);
   btn1.setBackground(Color.CYAN);
   btn2.setBackground(Color.BLACK);
   btn2.setForeground(Color.WHITE);
   btn3.setBackground(Color.YELLOW);
   this.setTitle(Integer.toString(i));
   btn1.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           i++;
           ct();
         }
       });
   btn2.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           i--;
           ct();
         }
       });
   btn3.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent arg0) {
           // TODO Auto-generated method stub
           System.exit(0);
         }
       });
 }
  public RedigerKategori() {

    this.setBackground(new Color(51, 161, 201));
    setLayout(null);

    JLabel TilføjKategori = new JLabel("Rediger Kategori");
    TilføjKategori.setIcon(
        new ImageIcon(TilføjVare.class.getResource("/presentation/resources/add32.png")));
    TilføjKategori.setFont(new Font("sansserif", Font.BOLD, 24));
    TilføjKategori.setForeground(Color.black);
    TilføjKategori.setBounds(30, 30, 250, 30);
    this.add(TilføjKategori);

    JLabel TilføjKategorinavn = new JLabel("Kategorinavn:");
    TilføjKategorinavn.setFont(new Font("Tahoma", Font.PLAIN, 12));
    TilføjKategorinavn.setBounds(140, 90, 140, 20);
    TilføjKategorinavn.setForeground(Color.black);
    add(TilføjKategorinavn);

    kategorinavnText = new JTextField();
    kategorinavnText.setBounds(230, 90, 300, 20);
    add(kategorinavnText);

    Button sletKategori = new Button("Slet");
    sletKategori.setBackground(new Color(255, 215, 10));
    sletKategori.setBounds(380, 160, 70, 22);
    sletKategori.setForeground(Color.black);
    add(sletKategori);

    sletKategori.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            controller.slet();
          }
        });

    Button TilføjKategori1 = new Button("Gem");
    TilføjKategori1.setBackground(new Color(255, 215, 10));
    TilføjKategori1.setBounds(460, 160, 70, 22);
    TilføjKategori1.setForeground(Color.black);
    add(TilføjKategori1);

    Ktable1 = new JTable();
    Ktable1.setBounds(12, 10, 710, 57);
    Ktable1.setBackground(new Color(238, 238, 238));
    add(Ktable1);

    JLabel TilføjOverKategori = new JLabel("Over kategori:");
    TilføjOverKategori.setFont(new Font("Tahoma", Font.PLAIN, 12));
    TilføjOverKategori.setBounds(140, 120, 140, 20);
    TilføjOverKategori.setForeground(Color.black);
    add(TilføjOverKategori);

    TilføjKategori1.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            System.out.println(controller);
            controller.updateKategori(kategorinavnText, combobox1);
          }
        });

    combobox1 = new JComboBox<String>();
    combobox1.setBounds(230, 120, 300, 20);
    add(combobox1);

    Ktable = new JTable();
    Ktable.setBounds(12, 71, 710, 405);
    Ktable.setBackground(new Color(238, 238, 238));
    add(Ktable);
  }
Example #7
0
  // swing gui / constructor
  public Main(final Field f) {
    super("Sudoku Solver");
    URL iconURL = getClass().getResource("icon.png");
    ImageIcon img = new ImageIcon(iconURL);
    jFrame.setIconImage(img.getImage());
    Color darkBlue = new Color(51, 102, 153);
    Color lightBlue = new Color(18, 61, 104);

    grid = new JTextField[9][9];
    jGrid.setLayout(new GridLayout(9, 9));
    jGrid.setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, darkBlue));
    jGrid.setBackground(darkBlue);
    for (int i = 0; i < 9; i++) {
      for (int j = 0; j < 9; j++) {
        grid[i][j] = new JTextField();
        grid[i][j].setDocument(new JTextFieldLimit(1));
        grid[i][j].setFont(new Font("Arial", Font.PLAIN, 20));
        grid[i][j].setHorizontalAlignment(JTextField.CENTER);
        grid[i][j].setText("");
        grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, lightBlue));
        if (j == 2 || j == 5) {
          grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 5, lightBlue));
        }
        if (i == 2 || i == 5) {
          grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 1, lightBlue));
        }
        if (i == 2 && j == 2) {
          grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue));
        }
        if (i == 5 && j == 2) {
          grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue));
        }
        if (i == 2 && j == 5) {
          grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue));
        }
        if (i == 5 && j == 5) {
          grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue));
        }
        jGrid.add(grid[i][j]);
      }
    }

    jButton.setLayout(new FlowLayout());
    jButton.setBackground(darkBlue);
    jButton.setPreferredSize(new Dimension(420, 45));

    jButton.add(solve);
    solve.setLabel("Solve");
    solve.setVisible(true);
    solve.setFont(new Font("HelveticaNeue", Font.PLAIN, 20));
    solve.setForeground(Color.BLACK);

    jButton.add(upload);
    upload.setLabel("Upload");
    upload.setVisible(true);
    upload.setFont(new Font("Arial", Font.PLAIN, 20));
    upload.setForeground(Color.BLACK);

    jButton.add(clear);
    clear.setLabel("Clear");
    clear.setVisible(true);
    clear.setFont(new Font("Arial", Font.PLAIN, 20));
    clear.setForeground(Color.BLACK);

    jGrid.setPreferredSize(new Dimension(400, 400));

    jFrame.setResizable(false);
    jFrame.setVisible(true);
    jFrame.setLocationRelativeTo(null);
    jFrame.setSize(420, 480);
    jFrame.setBackground(darkBlue);

    jFrame.add(jGrid, BorderLayout.PAGE_START);
    jFrame.add(jButton, BorderLayout.PAGE_END);

    ActionListener solvedClicked =
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            makeGridWhite();
            gridToModel(f);
            if (!errorFound(f)) {
              runSolve(f);
              makeGrid(f, false);
              solve.setEnabled(false);
            }
          }
        };

    ActionListener uploadClicked =
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            makeGridWhite();
            f.clearModel();
            makeGrid(f, true);
            solve.setEnabled(true);
            f.fromFile();
            makeGrid(f, true);
          }
        };

    ActionListener clearClicked =
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            makeGridWhite();
            f.clearModel();
            makeGrid(f, true);
            solve.setEnabled(true);
          }
        };

    solve.addActionListener(solvedClicked);
    upload.addActionListener(uploadClicked);
    clear.addActionListener(clearClicked);
  }
Example #8
0
  public MyFrame() {
    super("My Dialer");

    GridLayout gl = new GridLayout(7, 1, 2, 2);
    setLayout(gl);

    Panel displayPanel = new Panel();
    Panel padPanel = new Panel();
    Panel padPanel1 = new Panel();
    Panel padPanel2 = new Panel();
    Panel padPanel3 = new Panel();
    Panel padPanel4 = new Panel();
    Panel butPanel = new Panel();
    Panel dialingPanel = new Panel();

    tfPhoneNumber = new TextField(20);
    displayPanel.add(tfPhoneNumber);
    //        padPanel.setLayout(new GridLayout(4,3,2,2));

    int i;
    for (i = 0; i < 9; i++) {
      dialPad[i] = new Button(Integer.toString(i + 1));
    }
    dialPad[9] = new Button("*");
    dialPad[10] = new Button("0");
    dialPad[11] = new Button("#");

    MyMouseAdapter ma = new MyMouseAdapter();
    for (i = 0; i < 12; i++) {
      dialPad[i].setForeground(Color.blue);
      dialPad[i].addMouseListener(ma);
      dialPad[i].setPreferredSize(new Dimension(25, 25));
      //	    dialPad[i].setSize(35,35);
      //	    padPanel.add(dialPad[i]);
    }

    // Try flow layout as grid layout does not give set button size.
    for (i = 0; i < 3; i++) {
      padPanel1.add(dialPad[i]);
    }

    for (i = 3; i < 6; i++) {
      padPanel2.add(dialPad[i]);
    }

    for (i = 6; i < 9; i++) {
      padPanel3.add(dialPad[i]);
    }
    for (i = 9; i < 12; i++) {
      padPanel4.add(dialPad[i]);
    }

    tfDialing = new TextField(20);
    dialingPanel.add(tfDialing);
    dialButton = new Button("Dial");
    cancelButton = new Button("Cancel/Erase");
    tfDialing.setEditable(false);
    dialButton.setSize(40, 20);
    cancelButton.setSize(40, 20);
    dialButton.addMouseListener(ma);
    dialButton.setForeground(Color.blue);
    cancelButton.setForeground(Color.blue);
    cancelButton.addMouseListener(ma);
    butPanel.add(dialButton);
    butPanel.add(cancelButton);

    displayPanel.setSize(250, 40);
    padPanel1.setSize(250, 40);
    padPanel2.setSize(180, 40);
    padPanel3.setSize(180, 40);
    padPanel4.setSize(180, 40);
    butPanel.setSize(250, 25);
    dialingPanel.setSize(250, 20);

    // Add Panels to Frame
    add(displayPanel);
    // add(padPanel);
    add(padPanel1);
    add(padPanel2);
    add(padPanel3);
    add(padPanel4);
    add(butPanel);
    add(dialingPanel);

    //        MyMouseAdapter ma = new MyMouseAdapter();
    //        button.addMouseListener(ma);

    setSize(250, 250);
    setVisible(true);
  }
  public void execute_TestCase2() throws Exception {
    setUndecorated(true);
    setRootPaneCheckingEnabled(false);
    setForeground(Color.BLACK);
    setBackground(Color.WHITE);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 774, 353);
    setLocationRelativeTo(null);
    setVisible(true);

    contentPane = new JPanel();
    contentPane.setFocusCycleRoot(true);
    contentPane.setDebugGraphicsOptions(DebugGraphics.NONE_OPTION);
    contentPane.setBounds(new Rectangle(100, 100, 130, 100));
    contentPane.setBackground(Color.WHITE);
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JLabel lblEnterThePath = new JLabel("Select Path of Working Folder");
    lblEnterThePath.setForeground(new Color(128, 128, 128));
    lblEnterThePath.setFont(new Font("Tahoma", Font.BOLD, 11));
    lblEnterThePath.setBackground(new Color(0, 0, 0));
    lblEnterThePath.setBounds(63, 104, 187, 31);
    contentPane.add(lblEnterThePath);

    txtHello = new JTextField();
    txtHello.setName("");
    txtHello.setBounds(271, 104, 296, 31);
    txtHello.setEditable(false);
    contentPane.add(txtHello);
    txtHello.setColumns(10);

    JLabel lblSelectPathOf = new JLabel("Select Path of Configuration File");
    lblSelectPathOf.setForeground(new Color(128, 128, 128));
    lblSelectPathOf.setFont(new Font("Tahoma", Font.BOLD, 11));
    lblSelectPathOf.setBounds(63, 149, 187, 28);
    contentPane.add(lblSelectPathOf);

    textField_1 = new JTextField();
    textField_1.setBounds(271, 146, 296, 31);
    textField_1.setEditable(false);
    contentPane.add(textField_1);
    textField_1.setColumns(10);

    JLabel lblWelcomeToVitalhealth = new JLabel("Welcome to VitalHealth Test Automation Framework");
    lblWelcomeToVitalhealth.setHorizontalTextPosition(SwingConstants.CENTER);
    lblWelcomeToVitalhealth.setForeground(new Color(128, 128, 128));
    lblWelcomeToVitalhealth.setFont(new Font("Tahoma", Font.BOLD, 14));
    lblWelcomeToVitalhealth.setHorizontalAlignment(SwingConstants.CENTER);
    lblWelcomeToVitalhealth.setBackground(Color.BLACK);
    lblWelcomeToVitalhealth.setBounds(191, 22, 465, 34);
    contentPane.add(lblWelcomeToVitalhealth);

    Button button = new Button("Browse");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            showOpenFileDialog();
          }
        });
    button.setForeground(Color.WHITE);
    button.setFont(new Font("Dialog", Font.BOLD, 12));
    button.setBackground(new Color(51, 153, 255));
    button.setBounds(573, 104, 113, 31);
    contentPane.add(button);

    Button button_1 = new Button("Browse");
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            showOpenFileDialog1();
          }
        });
    button_1.setForeground(Color.WHITE);
    button_1.setFont(new Font("Dialog", Font.BOLD, 12));
    button_1.setBackground(new Color(51, 153, 255));
    button_1.setBounds(573, 146, 113, 31);
    contentPane.add(button_1);

    Button button_2 = new Button("RUN TEST");
    button_2.setForeground(Color.WHITE);
    button_2.setFont(new Font("Dialog", Font.BOLD, 12));
    button_2.setBackground(new Color(30, 144, 255));
    button_2.setBounds(63, 205, 623, 34);
    contentPane.add(button_2);

    Button button_3 = new Button("DOWNLOAD SAMPLE EXCEL WEB");
    button_3.setActionCommand("DOWNLOAD SAMPLE EXCEL WEB");
    button_3.setForeground(new Color(128, 128, 128));
    button_3.setFont(new Font("Dialog", Font.BOLD, 12));
    button_3.setBackground(Color.WHITE);
    button_3.setBounds(564, 309, 200, 34);
    contentPane.add(button_3);

    Button button_4 = new Button("DOWNLOAD SAMPLE EXCEL MOBILE");
    button_4.setForeground(new Color(128, 128, 128));
    button_4.setFont(new Font("Dialog", Font.BOLD, 12));
    button_4.setBackground(Color.WHITE);
    button_4.setActionCommand("DOWNLOAD SAMPLE EXCEL MOBILE");
    button_4.setBounds(23, 309, 227, 34);
    contentPane.add(button_4);

    JLabel icon = new JLabel("");
    Image img = new ImageIcon(this.getClass().getResource("/VitalHealth.png")).getImage();
    icon.setIcon(new ImageIcon(img));
    icon.setBounds(23, 11, 173, 71);
    contentPane.add(icon);

    // L1 l1 = new L1();
    L2 l2 = new L2();
    button_4.addActionListener(new L1(Constants.Download_ExcelWeb, Constants.Excel_NameMobile));
    button_3.addActionListener(new L1(Constants.Download_ExcelWeb, Constants.Excel_NameWeb));
    button_2.addActionListener(l2);
  }