Exemple #1
2
  AdminMain() {
    l = new JLabel();
    l.setBounds(10, 20, 1340, 1000);
    l.setBackground(Color.black);
    Font ft = new Font("Arial", Font.BOLD, 30);
    Font ft1 = new Font("Arial", Font.BOLD, 14);
    Font ft2 = new Font("Arial", Font.BOLD, 20);

    f1 = new Frame("Soft Test Management (Beta)");
    f1.setLayout(null);

    l1 = new Label("Test Instructions", l1.CENTER);
    l1.setBounds(10, 20, 1300, 60);
    l1.setForeground(Color.blue);
    l1.setBackground(Color.white);
    l1.setFont(ft);

    l2 = new JLabel("Deletion of Faculty/Students");
    l2.setBounds(20, 30, 1000, 500);
    l2.setBackground(Color.blue);
    l2.setFont(ft2);
    l3 = new JLabel("Test Pattern");
    l3.setBounds(20, 90, 1300, 500);
    l3.setBackground(Color.green);
    l3.setFont(ft2);

    b1 = new JButton("Go !");
    b1.setBounds(300, 220, 120, 30);
    b1.setBackground(Color.white);
    b1.setForeground(Color.blue);
    b1.setFont(ft2);

    b2 = new JButton("Go");
    b2.setBounds(300, 240, 120, 30);
    b2.setBackground(Color.white);
    b2.setForeground(Color.blue);
    b2.setFont(ft2);

    f1.add(l);
    l.add(l1);
    l2.add(b1);
    l.add(l2);
    l3.add(b2);
    l.add(l3);

    b1.addActionListener(this);
    b2.addActionListener(this);

    f1.setVisible(true);
    f1.setSize(1800, 800);
  }
  /**
   * Init JWhiteBoard interface
   *
   * @throws Exception
   */
  public void go() throws Exception {
    if (!noChannel && !useState) channel.connect(groupName);
    mainFrame = new JFrame();
    mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    drawPanel = new DrawPanel(useState);
    drawPanel.setBackground(backgroundColor);
    subPanel = new JPanel();
    mainFrame.getContentPane().add("Center", drawPanel);
    clearButton = new JButton("Clean");
    clearButton.setFont(defaultFont);
    clearButton.addActionListener(this);
    leaveButton = new JButton("Exit");
    leaveButton.setFont(defaultFont);
    leaveButton.addActionListener(this);
    subPanel.add("South", clearButton);
    subPanel.add("South", leaveButton);
    mainFrame.getContentPane().add("South", subPanel);
    mainFrame.setBackground(backgroundColor);
    clearButton.setForeground(Color.blue);
    leaveButton.setForeground(Color.blue);
    mainFrame.pack();
    mainFrame.setLocation(15, 25);
    mainFrame.setBounds(new Rectangle(250, 250));

    if (!noChannel && useState) {
      channel.connect(groupName, null, stateTimeout);
    }
    mainFrame.setVisible(true);
  }
Exemple #3
0
  // Create small Pits in board
  private JPanel centerBoardPanel() {
    JPanel centerPanel = new JPanel(new GridLayout(2, 6, 20, 100));
    centerPanel.setOpaque(false);

    /*Initialize/Create buttons Array */
    buttons = new JButton[SMALL_PIT_COUNT];

    for (int i = 0; i < SMALL_PIT_COUNT; i++) {
      if (i < SMALL_PIT_COUNT / 2) {
        JButton b = new JButton(String.valueOf(game.board.getPitAt(i).getCount()));
        b.setFont(new Font("Belta Regular", Font.BOLD, 32));
        b.addActionListener(new ButtonListener());
        buttons[i] = b;
      } else {
        JButton b = new JButton(String.valueOf(game.board.getPitAt(i + 1).getCount()));
        b.setFont(new Font("Belta Regular", Font.BOLD, 32));
        b.addActionListener(new ButtonListener());
        buttons[i] = b;
      }
    }

    for (int i = SMALL_PIT_COUNT - 1; i >= 6; i--) {
      buttons[i].setBackground(new Color(214, 162, 173));
      centerPanel.add(buttons[i]);
    }

    for (int j = 0; j < SMALL_PIT_COUNT / 2; j++) {
      buttons[j].setBackground(new Color(214, 162, 173));
      centerPanel.add(buttons[j]);
    }

    return centerPanel;
  }
  public SurrenderUI() {
    setType(Type.UTILITY);

    ExitB = new JButton("Exit");
    ExitB.setFont(new Font("Tahoma", Font.BOLD, 12));
    ExitB.setBackground(new Color(255, 215, 0));
    ExitB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
            new HSmain();
          }
        });
    ExitB.setBounds(461, 427, 296, 60);

    setTitle("Surrendering a Pet");
    Container pane = getContentPane();
    getContentPane().setLayout(null);
    pane.add(ExitB);

    txtSurrender = new JTextField();
    txtSurrender.setEditable(false);
    txtSurrender.setForeground(new Color(0, 0, 0));
    txtSurrender.setBackground(new Color(255, 215, 0));
    txtSurrender.setBounds(10, 11, 764, 50);
    txtSurrender.setHorizontalAlignment(SwingConstants.CENTER);
    txtSurrender.setFont(new Font("Lucida Handwriting", Font.BOLD, 18));
    txtSurrender.setText("Surrendering a Pet");
    getContentPane().add(txtSurrender);
    txtSurrender.setColumns(10);

    BackB = new JButton("Back");
    BackB.setFont(new Font("Tahoma", Font.BOLD, 12));
    BackB.setBackground(new Color(255, 215, 0));
    BackB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new AnimalServiceUI();
            dispose();
          }
        });
    BackB.setBounds(26, 427, 320, 60);
    getContentPane().add(BackB);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(0, 72, 764, 329);
    getContentPane().add(scrollPane);

    JTextPane txtSurrenderInfo = new JTextPane();
    scrollPane.setViewportView(txtSurrenderInfo);
    txtSurrenderInfo.setForeground(new Color(0, 0, 0));
    txtSurrenderInfo.setEditable(false);
    txtSurrenderInfo.setFont(new Font("Times New Roman", Font.BOLD, 15));
    txtSurrenderInfo.setText(
        "\tThe Humane Society of Lamar cannot accept every animal brought to our shelter immediately. \r\nWe respect the difficult decision of owners to relinquish their pets, and the hard choices of those \r\ngood citizens who are trying to help a stray. We accept the surrender of pets as space allows. \r\nWe maintain a waiting list for all animals needing to be admitted to the shelter.\r\nAnimals are surrendered to our facility by appointment.\r\nWe admit at least 12 animals per week. We accept more animals as adoptions and space allow.\r\nNote that we cannot accept aggressive, sick or pregnant animals.\r\nPlease call 409-225-7981, and one of our adoption specialists will speak to you.\r\nAt times our waiting list will have up to 100 animals waiting for admission and it can take several weeks \r\nbefore we can admit your pet.\r\nPlease understand that our primary goal is to place as many animals in forever homes as possible, \r\ntherefore we must give every pet admitted to the shelter enough time to find a loving home. \r\nWe cannot guarantee placement of every animal admitted to the shelter.\r\n\t\r\n\tAdmission of any animal into the Humane Society of Lamar  is based on the animal\u2019s health, \r\nbehavior, and adoptability. When you bring your pets, please have:\r\n\r\n    *Any veterinary records\r\n    *Your pet\u2019s medications\r\n    *Special food or treats that your pet needs\r\n    *Your pet\u2019s bed, toys, leash and other belongings from home\r\n\r\nA staff member will evaluate the temperament of your pet. Once your pet has been screened, \r\nand the Humane Society of Lamar decides to accept your pet, we ask a donation to our shelter to be made. \r\nThis is not required, but will greatly help us care for your pet.");

    setSize(800, 553);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
Exemple #5
0
  public Perfil() {
    super.setBounds(181, 61, 700, 538); // (ancho,alto)
    super.setLayout(null);
    super.setOpaque(false);
    super.setVisible(false);

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    jbtnGuardar = new JButton("Guardar Cambios");
    jbtnGuardar.setBounds(55, 457, 150, 40);
    jbtnGuardar.addActionListener(this);
    jbtnGuardar.setBorder(null);
    jbtnGuardar.setBackground(new Color(0, 154, 225));
    jbtnGuardar.setForeground(Color.WHITE);
    jbtnGuardar.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnGuardar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnGuardar.setFocusPainted(false);
    this.add(jbtnGuardar);

    nombre = new JLabel("Ninguna imagen seleccionada");
    nombre.setBounds(210, 250, 200, 40);
    nombre.setForeground(Color.GRAY);
    this.add(nombre);

    jbtnCargarI = new JButton("Cargar imagen");
    jbtnCargarI.setBounds(55, 250, 150, 40);
    jbtnCargarI.addActionListener(this);
    jbtnCargarI.setBorder(null);
    jbtnCargarI.setBackground(new Color(0, 154, 225));
    jbtnCargarI.setForeground(Color.WHITE);
    jbtnCargarI.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnCargarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnCargarI.setFocusPainted(false);
    this.add(jbtnCargarI);

    jbtnQuitarI = new JButton("Quitar imagen");
    jbtnQuitarI.setBounds(55, 186, 150, 40);
    jbtnQuitarI.addActionListener(this);
    jbtnQuitarI.setBorder(null);
    jbtnQuitarI.setBackground(new Color(0, 154, 225));
    jbtnQuitarI.setForeground(Color.WHITE);
    jbtnQuitarI.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnQuitarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnQuitarI.setFocusPainted(false);
    this.add(jbtnQuitarI);

    jlbimage = new JLabel();
    jlbimage.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    jlbimage.setBounds(55, 46, 150, 150);
    this.add(jlbimage);

    this.repaint();
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setVisible(true);
    frame.setResizable(false);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JButton btnCustomer = new JButton("Customer");
    btnCustomer.setFont(new Font("Tahoma", Font.BOLD, 16));
    btnCustomer.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            JOptionPane.showMessageDialog(null, "Welcome to Coffee Kiosk ");
            // Coffee1 nw = new Coffee1();
            // nw.NewScreen();
            cust = cust + 1;
            Customer cs = new Customer();
            cs.CustomerScreen();
          }
        });
    btnCustomer.setBounds(83, 94, 117, 86);
    frame.getContentPane().add(btnCustomer);

    JButton btnAdmin = new JButton("Admin");
    btnAdmin.setFont(new Font("Tahoma", Font.BOLD, 16));
    btnAdmin.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(null, "Welcome Admin ");
            Login ls = new Login();
            ls.LoginScreen();
          }
        });

    btnAdmin.setBounds(229, 94, 117, 86);
    frame.getContentPane().add(btnAdmin);

    JButton btnExit = new JButton("EXIT");
    btnExit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            JOptionPane.showMessageDialog(null, "Thank You for using Coffee Kiosk");
            System.exit(0);
          }
        });
    btnExit.setBounds(168, 207, 89, 23);
    frame.getContentPane().add(btnExit);

    JLabel lblLeedsCoffeeKiosk = new JLabel("LEEDS COFFEE KIOSK");
    lblLeedsCoffeeKiosk.setHorizontalAlignment(SwingConstants.CENTER);
    lblLeedsCoffeeKiosk.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 30));
    lblLeedsCoffeeKiosk.setForeground(new Color(148, 0, 211));
    lblLeedsCoffeeKiosk.setBounds(36, 11, 366, 72);
    frame.getContentPane().add(lblLeedsCoffeeKiosk);
  }
Exemple #7
0
  public JButton ButtonProperties(JButton button) {

    button.setFont(componentFont);
    button.setBorderPainted(false);
    button.setFocusPainted(false);
    button.setBackground(themeColor1);
    button.setForeground(themeColor4);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {

            button.setBackground(themeColor2);
            button.setForeground(Color.BLACK);
          }

          @Override
          public void mouseExited(MouseEvent e) {

            button.setBackground(themeColor1);
            button.setForeground(themeColor4);
          }
        });
    return button;
  }
Exemple #8
0
  public JButton ButtonProperties(JButton button, String buttonText) {

    button.setFont(componentFont);
    button.setBorderPainted(false);
    button.setFocusPainted(false);
    button.setBackground(themeColor1);
    button.setForeground(themeColor4);
    button.setVerticalTextPosition(SwingConstants.BOTTOM);
    button.setHorizontalTextPosition(SwingConstants.CENTER);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {

            button.setBackground(themeColor2);
            button.setForeground(Color.BLACK);
            button.setText(buttonText);
          }

          @Override
          public void mouseExited(MouseEvent e) {

            button.setBackground(themeColor1);
            button.setForeground(themeColor4);
            button.setText("");
          }
        });
    return button;
  }
Exemple #9
0
  public TestPanels() {
    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(4, 3)); /*GridLayout的构造方法*/
    JButton jb = null;
    for (int i = 1; i <= 9; i++) {
      jb = new JButton("" + i);
      /*创建字体*/
      Font ft = new Font("Microsoft YaHei UI Light", Font.BOLD + Font.ITALIC, 20 + i);
      /*设置JButton的字体*/
      jb.setFont(ft);
      /*设置JButton的前景色和背景色
       *这两个方法是Component类的方法
       **/
      jb.setBackground(Color.BLACK);
      jb.setForeground(Color.WHITE);
      p1.add(jb);
    }
    p1.add(new JButton("" + 0));
    p1.add(new JButton("Start"));
    p1.add(new JButton("Stop"));

    JPanel p2 = new JPanel();
    p2.setLayout(new BorderLayout());
    p2.add(new JTextField("Time to be displayed here."), BorderLayout.NORTH);
    p2.add(p1, BorderLayout.CENTER);

    setLayout(new BorderLayout());
    add(new JButton("Food to be placed here."), BorderLayout.WEST);
    add(p2, BorderLayout.CENTER);
  }
Exemple #10
0
  private void addButton(String n) {

    JButton b = new JButton(n);
    b.setFont(new Font("Dialog", Font.BOLD, 12));
    b.addActionListener(this);
    controls.add(b);
  }
Exemple #11
0
  public Gui() throws IOException {
    setSize(1024, 798);
    setBackground(Color.white);
    setTitle("Dyna-stryfe");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    addbackgound(this);
    getContentPane().setLayout(null);
    setResizable(false);
    setBackground(new Color(204, 204, 204));
    setVisible(true);

    b2 = new JButton("Play");
    b2.setBackground(Color.BLACK);
    b2.setFont(new Font("Showcard Gothic", Font.BOLD | Font.ITALIC, 11));
    b2.setForeground(Color.WHITE);
    b2.setBounds(450, 550, 132, 43);
    b2.addActionListener(this);
    add(b2);

    demo = new JLabel("<html><font color='white'>Demo version: 0.000011 </font></html>");
    demo.setBounds(870, 660, 300, 30);
    this.add(demo);

    accionarAgarreAutomatico = new JButton();
    accionarAgarreAutomatico.addActionListener(this);
  }
    public void createColorPanel() {
      JPanel colorPanel = new JPanel(new GridLayout(0, 1));
      int curRow = 0;
      for (int i = 0; i < colorString.length / 5; i++) {
        JPanel row = new JPanel(new GridLayout(1, 0, 2, 1));
        row.setBorder(new EmptyBorder(2, 2, 2, 2));

        for (int j = curRow; j < curRow + 5; j++) {
          final JLabel colorLabel =
              new JLabel(null, new ColoredIcon(color[j], 14, 14), JLabel.CENTER);
          colorLabel.setOpaque(true);
          final Border emb = BorderFactory.createEmptyBorder(2, 1, 2, 1);
          final Border lnb = BorderFactory.createLineBorder(Color.black);
          final Border cmb = BorderFactory.createCompoundBorder(lnb, emb);
          colorLabel.setBorder(emb);
          colorLabel.addMouseListener(
              new MouseAdapter() {

                public void mouseClicked(MouseEvent e) {
                  JButton btn = (JButton) getTarget();
                  Color selColor = ((ColoredIcon) colorLabel.getIcon()).getCurrentColor();
                  btn.setIcon(new ColoredIcon(selColor));
                  setVisible(false);
                  btn.doClick();
                  oldLabel.setBackground(null);
                  colorLabel.setBackground(new Color(150, 150, 200));
                  colorLabel.setBorder(emb);
                  oldLabel = colorLabel;
                }

                public void mouseEntered(MouseEvent e) {
                  colorLabel.setBorder(cmb);
                  colorLabel.setBackground(new Color(150, 150, 200));
                }

                public void mouseExited(MouseEvent e) {
                  colorLabel.setBorder(emb);
                  colorLabel.setBackground(null);
                }
              });
          row.add(colorLabel);
        }
        colorPanel.add(row);
        curRow += row.getComponentCount();
        // System.out.println(curRow);
      }

      add(colorPanel, BorderLayout.CENTER);

      // More Colors Button
      moreColors = new JButton(new ColorChooserAction((JButton) target));
      moreColors.setText("More Colors...");
      moreColors.setIcon(null);
      moreColors.setFont(new Font("Verdana", Font.PLAIN, 10));
      //
      JPanel c = new JPanel(new FlowLayout(FlowLayout.CENTER));
      c.add(moreColors);
      add(c, BorderLayout.SOUTH);
    }
 /**
  * Creates a JButton with an X
  *
  * @return the button
  */
 private JButton createXButton() {
   JButton closeButton = new JButton("X");
   closeButton.setOpaque(false);
   closeButton.setMargin(null);
   closeButton.setFont(closeButton.getFont().deriveFont(Font.BOLD).deriveFont((float) 10));
   closeButton.setBorder(new EmptyBorder(1, 1, 1, 1));
   return closeButton;
 }
  public void initComponents() {
    /** ******************** The main container *************************** */
    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());
    container.setBackground(Color.black);
    this.setSize(650, 600);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {}
        });

    /** ************************* MAIN PANEL ******************************* */
    mainPanel = new JPanel();
    // If put to False: we see the container's background
    mainPanel.setOpaque(false);
    mainPanel.setLayout(new BorderLayout());
    container.add(mainPanel, BorderLayout.CENTER);

    allmessagesTextArea = new TextArea();
    allmessagesTextArea.setEditable(false);
    allmessagesTextArea.setFont(new Font("Dialog", 1, 12));
    allmessagesTextArea.setForeground(Color.black);
    allmessagesTextArea.append("Select a session in the list to view its messages");
    mainPanel.add(allmessagesTextArea, BorderLayout.CENTER);

    sessionsList = new List();
    sessionsList.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            showMessages(e);
          }
        });
    sessionsList.setForeground(Color.black);
    sessionsList.setFont(new Font("Dialog", 1, 14));
    mainPanel.add(sessionsList, BorderLayout.WEST);

    okButton = new JButton("  OK  ");
    okButton.setToolTipText("Returns to the main frame");
    okButton.setFont(new Font("Dialog", 1, 16));
    okButton.setFocusPainted(false);
    okButton.setBackground(Color.lightGray);
    okButton.setBorder(new BevelBorder(BevelBorder.RAISED));
    okButton.setVerticalAlignment(SwingConstants.CENTER);
    okButton.setHorizontalAlignment(SwingConstants.CENTER);
    container.add(okButton, BorderLayout.SOUTH);
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            setVisible(false);
          }
        });
  }
Exemple #15
0
  /**
   * List of Local Variables: azure: Color object to set as background buttonFont: Font object to
   * use in buttons newGame: JButton object switchPlayer: JButton object quit: JButton object
   *
   * <p>Explanation: default constructor
   */
  public Board() {
    Color azure = new Color(240, 255, 255); // create colour

    // enable custom resizing (java sets components in ratios by default)
    this.setLayout(null);

    // add mouse listener
    this.addMouseListener(this);
    // change background colour
    this.setBackground(azure);

    // create font to use for buttons
    Font buttonFont = new Font("Times New Roman", Font.BOLD, 18);

    // create+add new Game button
    // String with some basic HTML for multi-line/centering
    JButton newGame = new JButton("<html><center>New<br>Game</center></html>");
    newGame.setFont(buttonFont);
    newGame.setHorizontalAlignment(SwingConstants.CENTER);
    newGame.setActionCommand("New Game");
    newGame.setBounds(570, 135, 80, 75);
    newGame.addActionListener(this);
    this.add(newGame);

    // create+add switch Player Button
    JButton switchPlayer = new JButton("<html><center>Switch<br>Player</center></html>");
    switchPlayer.setFont(buttonFont);
    switchPlayer.setHorizontalAlignment(SwingConstants.CENTER);
    switchPlayer.setActionCommand("Switch Player");
    switchPlayer.setBounds(570, 220, 80, 75);
    switchPlayer.addActionListener(this);
    this.add(switchPlayer);

    // create+add quit Button
    JButton quit = new JButton("<html><center>Quit</center></html>");
    quit.setFont(buttonFont);
    quit.setHorizontalAlignment(SwingConstants.CENTER);
    quit.setActionCommand("Quit");
    quit.setBounds(570, 305, 80, 75);
    quit.addActionListener(this);
    this.add(quit);
  }
  public Abschluss(String wahl, Sudoku s, Sudoku2 s2) {
    super("Sudoku-Abschluss");
    this.setSize(270, 135);
    this.setLocation(250, 300);
    this.setLayout(null);
    this.setAlwaysOnTop(true);
    this.setResizable(false);
    this.setUndecorated(true);
    if (s == null) this.setLocationRelativeTo(s2);
    else this.setLocationRelativeTo(s);

    su = s;
    su2 = s2;
    w = wahl;

    ImageIcon icon = new ImageIcon("files/minigames/Sudoku/beispiel2.jpg");
    icon.setImage(icon.getImage().getScaledInstance(290, 135, Image.SCALE_DEFAULT));

    lab = new JLabel(icon);
    lab.setSize(270, 135);
    lab.setLocation(0, 0);
    this.add(lab);

    text = new JLabel();
    text.setSize(250, 20);
    text.setLocation(10, 10);
    text.setForeground(Color.white);
    text.setHorizontalAlignment(0);
    lab.add(text);

    text2 = new JLabel();
    text2.setSize(270, 20);
    text2.setLocation(10, 30);
    text2.setForeground(Color.white);
    lab.add(text2);

    ok = new JButton("OK");
    ok.setSize(90, 30);
    ok.setLocation(80, 50);
    ok.setBorderPainted(false);
    ok.setBackground(Color.lightGray);
    ok.setForeground(Color.lightGray);
    ok.setOpaque(false);
    ok.setFont(new Font("Arial Black", 4, 20));
    ok.setContentAreaFilled(false);
    ok.setFocusPainted(false);
    ok.addActionListener(this);
    ok.addMouseListener(this);
    lab.add(ok);

    textWahl(wahl);

    this.setVisible(true);
  }
 /**
  * Gets the instance of the CenterButton
  *
  * @return The instance of the CenterButton
  */
 public static JButton getCenterButton() {
   if (centerButton == null) {
     centerButton = new JButton();
     centerButton.setText(Constants.CENTER);
     centerButton.setHorizontalAlignment(SwingConstants.CENTER);
     centerButton.setFont(new Font("Dialog", Font.BOLD, 14));
     centerButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     centerButton.setActionCommand(Constants.CENTER);
     centerButton.addActionListener(ButtonListener.getInstance());
   }
   return centerButton;
 }
 /**
  * Gets the instance of the ConnectButton
  *
  * @return The instance of the ConnectButton
  */
 public static JButton getConnectButton() {
   if (connectButton == null) {
     connectButton = new JButton();
     connectButton.setText(Constants.CONNECT);
     connectButton.setHorizontalAlignment(SwingConstants.CENTER);
     connectButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     connectButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     connectButton.setActionCommand(Constants.CONNECT);
     connectButton.addActionListener(ButtonListener.getInstance());
   }
   return connectButton;
 }
Exemple #19
0
  /*Creates the East section of the mancala board. Contains Collection Pit*/
  private JPanel eastBoardPanel() {
    JPanel eastPanel = new JPanel();
    eastPanel.setOpaque(false);
    eastPanel.setPreferredSize(new Dimension(150, 600));

    b6 = new JButton(String.valueOf(game.board.getPitAt(6).getCount()));
    b6.setPreferredSize(new Dimension(100, 330));
    b6.setFont(new Font("Belta Regular", Font.BOLD, 32));
    b6.setBackground(new Color(214, 162, 173));
    eastPanel.add(b6);
    return eastPanel;
  }
 /**
  * Gets the instance of the SlowButton
  *
  * @return The instance of the SlowButton
  */
 public static JButton getSlowButton() {
   if (slowButton == null) {
     slowButton = new JButton();
     slowButton.setText(Constants.STOP);
     slowButton.setHorizontalAlignment(SwingConstants.CENTER);
     slowButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     slowButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     slowButton.setActionCommand(Constants.SLOW);
     slowButton.addActionListener(ButtonListener.getInstance());
   }
   return slowButton;
 }
  private JButton createButton(final Commontags commontag) {

    if (mapButtons.containsKey(commontag)) {
      OPDE.debug("shortcut");
      return mapButtons.get(commontag);
    }

    final JButton jButton =
        new JButton(
            commontag.getText(),
            editmode ? SYSConst.icon16tagPurpleDelete2 : SYSConst.icon16tagPurple);
    jButton.setFont(SYSConst.ARIAL12);
    jButton.setBorder(new RoundedBorder(10));
    jButton.setHorizontalTextPosition(SwingConstants.LEADING);
    jButton.setForeground(SYSConst.purple1[SYSConst.dark3]);

    if (editmode) {

      jButton.addActionListener(
          e -> {
            listSelectedTags.remove(commontag);
            mapButtons.remove(commontag);
            SwingUtilities.invokeLater(
                () -> {
                  removeAll();

                  add(txtTags);
                  if (btnPickTags != null) {
                    add(btnPickTags);
                  }
                  int tagnum = 1;

                  for (JButton btn : mapButtons.values()) {
                    if (tagnum % MAXLINE == 0) {
                      add(btn, RiverLayout.LINE_BREAK);
                    } else {
                      add(btn, RiverLayout.LEFT);
                    }
                    tagnum++;
                  }

                  remove(jButton);
                  revalidate();
                  repaint();
                  notifyListeners(commontag);
                });
          });
    }
    mapButtons.put(commontag, jButton);

    return jButton;
  }
  // Method to build the dialog box for help.
  private void buildDialogBox() {
    // Set the JDialog window properties.
    setTitle("Stack Trace Detail");
    setResizable(false);
    setSize(dialogWidth, dialogHeight);

    // Append the stack trace output to the display area.
    displayArea.append(eStackTrace);

    // Create horizontal and vertical scrollbars for box.
    displayBox = Box.createHorizontalBox();
    displayBox = Box.createVerticalBox();

    // Add a JScrollPane to the Box.
    displayBox.add(new JScrollPane(displayArea));

    // Define behaviors of container.
    c.setLayout(null);
    c.add(displayBox);
    c.add(okButton);

    // Set scroll pane bounds.
    displayBox.setBounds(
        (dialogWidth / 2) - ((displayAreaWidth / 2) + 2),
        (top + (offsetMargin / 2)),
        displayAreaWidth,
        displayAreaHeight);

    // Set the behaviors, bounds and action listener for the button.
    okButton.setBounds(
        (dialogWidth / 2) - (buttonWidth / 2),
        (displayAreaHeight + offsetMargin),
        buttonWidth,
        buttonHeight);

    // Set the font to the platform default Font for the object with the
    // properties of bold and font size of 11.
    okButton.setFont(new Font(okButton.getFont().getName(), Font.BOLD, 11));

    // The class implements the ActionListener interface and therefore
    // provides an implementation of the actionPerformed() method.  When a
    // class implements ActionListener, the instance handler returns an
    // ActionListener.  The ActionListener then performs actionPerformed()
    // method on an ActionEvent.
    okButton.addActionListener(this);

    // Set the screen and display dialog window in relation to screen size.
    setLocation((dim.width / 2) - (dialogWidth / 2), (dim.height / 2) - (dialogHeight / 2));

    // Display JDialog.
    show();
  } // End of buildDialogBox method.
  public MaritimeTradeView() {

    this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    Font font = new JButton().getFont();
    Font newFont = font.deriveFont(font.getStyle(), 20);

    button = new JButton("Maritime Trade");
    button.setFont(newFont);
    button.addActionListener(buttonListener);

    this.add(button);
  }
 /**
  * Gets the instance of the ResetButton
  *
  * @return The instance of the ResetButton
  */
 public static JButton getResetButton() {
   if (resetButton == null) {
     resetButton = new JButton();
     resetButton.setText(Constants.RESET);
     resetButton.setHorizontalAlignment(SwingConstants.CENTER);
     resetButton.setFont(Constants.DEFAULT_BUTTON_FONT);
     resetButton.setAlignmentX(Component.CENTER_ALIGNMENT);
     resetButton.setActionCommand(Constants.RESET);
     resetButton.addActionListener(ButtonListener.getInstance());
     resetButton.setEnabled(false);
   }
   return resetButton;
 }
  public RollResultView() {

    this.setOpaque(true);
    this.setLayout(new BorderLayout());
    this.setBorder(BorderFactory.createLineBorder(Color.black, BORDER_WIDTH));

    // add the title label to the panel
    titleLabel = new JLabel("Roll Results");
    Font titleLabelFont = titleLabel.getFont();
    titleLabelFont = titleLabelFont.deriveFont(titleLabelFont.getStyle(), TITLE_TEXT_SIZE);
    titleLabel.setFont(titleLabelFont);
    this.add(titleLabel, BorderLayout.NORTH);

    // add the button to the panel
    okayButton = new JButton("Okay");
    okayButton.addActionListener(actionListener);
    Font okayButtonFont = okayButton.getFont();
    okayButtonFont = okayButtonFont.deriveFont(okayButtonFont.getStyle(), BUTTON_TEXT_SIZE);
    okayButton.setFont(okayButtonFont);
    this.add(okayButton, BorderLayout.SOUTH);

    // create the rollLabel
    rollLabel =
        new JLabel(
            "ERROR: YOU FORGOT TO SET THE ROLL VALUE BEFORE DISPLAYING THIS WINDOW... NAUGHTY, NAUGHTY");
    Font rollLabelFont = rollLabel.getFont();
    rollLabelFont = rollLabelFont.deriveFont(rollLabelFont.getStyle(), LABEL_TEXT_SIZE);
    rollLabel.setFont(rollLabelFont);
    rollLabel.setHorizontalAlignment(SwingConstants.CENTER);
    rollLabel.setBorder(BorderFactory.createEmptyBorder(25, 0, 25, 0));

    // create the picture
    picture =
        new ImageIcon(
            ImageUtils.loadImage("images/resources/resources.png")
                .getScaledInstance(250, 250, Image.SCALE_SMOOTH));
    pictureLabel = new JLabel();
    pictureLabel.setIcon(picture);

    // create the center label
    centerPanel = new JPanel();
    centerPanel.setLayout(new BorderLayout());
    centerPanel.add(pictureLabel, BorderLayout.NORTH);
    centerPanel.add(Box.createRigidArea(new Dimension(25, 25)));
    centerPanel.add(rollLabel, BorderLayout.SOUTH);
    this.add(centerPanel, BorderLayout.CENTER);

    // add some spacing
    this.add(Box.createRigidArea(new Dimension(50, 50)), BorderLayout.EAST);
    this.add(Box.createRigidArea(new Dimension(50, 50)), BorderLayout.WEST);
  }
    /** Constructor. */
    public FileChooserCellEditor() {
      super(new JTextField());
      setClickCountToStart(CLICK_COUNT_TO_START);

      // Using a JButton as the editor component
      button = new JButton();
      button.setBackground(Color.white);
      button.setFont(button.getFont().deriveFont(Font.PLAIN));
      button.setBorder(null);

      // Dialog which will do the actual editing
      fileChooser = new JFileChooser();
      fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    }
  public StrategyPanel(TrainingTeaBLService TrainingTeaBLService, Message message) {
    try {
      UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");

    } catch (Exception e) {

      e.printStackTrace();
    }
    this.setTrainingTeaBLService(TrainingTeaBLService);
    this.setMessage(message);
    this.setLayout(new BorderLayout());
    strategy = new JPanel(new BorderLayout()); // 放Table的面板或者Label的面板
    jl1 = new JLabel("尚未发布整体框架策略!");
    jl1.setFont(MyTools.f6);
    strategy.add(jl1, "North");

    buttonPanel = new JPanel(new FlowLayout());
    jb1 = new JButton("输入整体框架策略");
    jb1.setFont(MyTools.f1);
    jb1.addActionListener(this);

    jb2 = new JButton("修改整体框架策略");
    jb2.setFont(MyTools.f1);
    jb2.addActionListener(this);

    refresh = new JButton("刷新");
    refresh.setFont(MyTools.f6);
    refresh.addActionListener(this);

    buttonPanel.add(jb1);
    buttonPanel.add(jb2);
    buttonPanel.add(refresh);

    refresh();
    this.add(strategy, "Center");
    this.add(buttonPanel, "South");
  }
 // Set up the quiz window
 Quiz() {
   initializeData();
   setTitle("FOSS Quiz App");
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   setSize(440, 400);
   setLocation(300, 100);
   setResizable(true);
   Container cont = getContentPane();
   cont.setLayout(null);
   cont.setBackground(Color.WHITE);
   bg = new ButtonGroup();
   choice1 = new JRadioButton("Choice1", true);
   choice2 = new JRadioButton("Choice2", false);
   choice3 = new JRadioButton("Choice3", false);
   choice4 = new JRadioButton("Choice4", false);
   bg.add(choice1);
   bg.add(choice2);
   bg.add(choice3);
   bg.add(choice4);
   lblmess = new JLabel("Choose a correct anwswer");
   lblmess.setForeground(Color.BLACK);
   lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15));
   btnext = new JButton("Next");
   btnext.setForeground(Color.WHITE);
   btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17));
   btnext.setBackground(Color.DARK_GRAY);
   btnext.addActionListener(this);
   panel = new JPanel();
   panel.setBackground(Color.WHITE);
   panel.setLocation(10, 60);
   panel.setSize(400, 300);
   panel.setLayout(new GridLayout(0, 1));
   title = new JPanel();
   title.setBackground(Color.WHITE);
   title.setLocation(10, 10);
   title.setSize(1000, 50);
   title.setLayout(new GridLayout(1, 0));
   title.add(lblmess);
   panel.add(choice1);
   panel.add(choice2);
   panel.add(choice3);
   panel.add(choice4);
   panel.add(btnext);
   cont.add(title);
   cont.add(panel);
   setVisible(true);
   quizAnswerID = 0;
   readQuestionAnswer(quizAnswerID);
 }
    // Method to build the dialog box for help.
    private void buildDialogBox() {
      // Set the JDialog window properties.
      setTitle("Learning about Java");
      setResizable(false);
      setSize(dialogWidth, dialogHeight);

      // Define behaviors of container.
      c.setLayout(null);
      c.setBackground(Color.cyan);
      c.add(image);
      c.add(okButton);

      // Set the bounds for the image.
      image.setBounds(
          (dialogWidth / 2) - (imageWidth / 2),
          (top + (offsetMargin / 2)),
          imageWidth,
          imageHeight);

      // Set the behaviors, bounds and action listener for the button.
      okButton.setBounds(
          (dialogWidth / 2) - (buttonWidth / 2),
          (imageHeight + (int) 1.5 * offsetMargin),
          buttonWidth,
          buttonHeight);

      // Set the font to the platform default Font for the object with the
      // properties of bold and font size of 11.
      okButton.setFont(new Font(okButton.getFont().getName(), Font.BOLD, 11));

      // Set foreground and background of JButton(s).
      okButton.setForeground(Color.white);
      okButton.setBackground(Color.blue);

      // The class implements the ActionListener interface and therefore
      // provides an implementation of the actionPerformed() method.  When a
      // class implements ActionListener, the instance handler returns an
      // ActionListener.  The ActionListener then performs actionPerformed()
      // method on an ActionEvent.
      okButton.addActionListener(this);

      // Set the screen and display dialog window in relation to screen size.
      dim = tk.getScreenSize();
      setLocation((dim.width / 2) - (dialogWidth / 2), (dim.height / 2) - (dialogHeight / 2));

      // Display the dialog.
      show();
    } // End of buildDialogBox method.
Exemple #30
0
  JPanel bottomPanel() {
    bot.setLayout(new BoxLayout(bot, BoxLayout.X_AXIS));
    bot.setBackground(COLOR);

    menu.setFont(DLOG);
    bot.add(menu);
    bot.add(Box.createHorizontalStrut(scaled(GAP)));
    stop.setFont(DLOG);
    bot.add(stop);
    bot.add(Box.createHorizontalGlue());
    who.setForeground(Color.black);
    who.setFont(BOLD);
    bot.add(who);

    return bot;
  }