Example #1
0
  @SuppressWarnings("static-access")
  public RepeatFrame(AddAppointmentFrame parent) {
    // TODO Auto-generated constructor stub
    this._Parent = parent;

    model.addColumn("exceptions");

    this.setLayout(new GridLayout(5, 2));

    this.add(countLabel);
    this.add(countTextField);
    this.add(frequencyLabel);
    this.add(frequencyTextField);
    this.add(exceptionLabel);
    exceptionPanel.add(exceptionDayTextField);
    exceptionPanel.add(exceptionMonthTextField);
    exceptionPanel.add(exceptionYearTextField);
    this.add(exceptionPanel);
    this.add(exceptionButton);
    this.add(new JScrollPane(exceptionTable));
    this.add(okButton);
    this.add(cancelButton);

    Calendar cal = Calendar.getInstance();

    exceptionYearTextField.setText(Integer.toString(cal.get(Calendar.YEAR)));

    okButton.addMouseListener(new MouseEventCal());
    cancelButton.addMouseListener(new MouseEventCal());
    exceptionButton.addMouseListener(new MouseEventCal());
  }
Example #2
0
  public ViewOperateUI(MainUIService main) {
    setLayout(null);
    m = main;
    this.setBounds(0, 0, 850, 700);
    this.setBackground(Color.WHITE);
    Font font2 = new Font("楷体", Font.BOLD, 18);

    JLabel title = new JLabel("经 营 状 态 表");
    title.setBounds(320, 30, 200, 40);
    title.setFont(font2);
    this.add(title);

    tabpane = new JTabbedPane(JTabbedPane.TOP);
    initPanelList();
    tabpane.setBounds(50, 80, tablewidth, tableheight);
    this.add(tabpane);

    Listener listen = new Listener();

    excel = new JButton("导出到Excel");
    excel.setBounds(250, 620, 150, 40);
    excel.setVisible(true);
    excel.setFont(new Font("隶书", Font.PLAIN, 20));
    excel.addMouseListener(listen);
    this.add(excel);

    exit = new JButton("返回");
    exit.setBounds(430, 620, 150, 40);
    exit.setVisible(true);
    exit.setFont(new Font("隶书", Font.PLAIN, 20));
    exit.addMouseListener(listen);
    this.add(exit);
  }
Example #3
0
  public Viewer() {
    model = new InformationTable();
    table =
        new JTable(model) {
          private static final long serialVersionUID = -60793358358809091L;

          // cannot edit the table
          @Override
          public boolean isCellEditable(int row, int column) {
            return false;
          }
        };
    scroll.setViewportView(table);
    scroll.setBorder(new TitledBorder("Control Table"));
    JPanel panel1 = new JPanel();
    panel1.setBorder(new TitledBorder("Menu"));
    panel1.setLayout(new FlowLayout(FlowLayout.LEFT, 100, 50));
    panel1.add(edit);
    panel1.add(fllush);
    panel1.add(save);
    edit.addMouseListener(new editMouseListener());
    fllush.addMouseListener(new fflushMouseListener());
    save.addMouseListener(new saveMouseListener());
    Container cp = getContentPane();
    cp.add(panel1);
    cp.add(scroll);
    cp.setLayout(new BoxLayout(cp, BoxLayout.Y_AXIS));
    setTitle("Access Control System");
    setVisible(true);
    setSize(1000, 600);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
Example #4
0
  public ScrollViewport(int direction) {
    setLayout(new BorderLayout());

    JButton button;

    // UP
    if ((direction & UP_DIRECTION) > 0) {
      button = new JButton();
      button.addMouseListener(new ScrollViewPortMouseListener(UP_DIRECTION));
      button.setPreferredSize(new Dimension(10, 10));
      button.setIcon(ImageProvider.get("svpUp"));
      add(button, BorderLayout.NORTH);
      buttons.add(button);
    }

    // DOWN
    if ((direction & DOWN_DIRECTION) > 0) {
      button = new JButton();
      button.addMouseListener(new ScrollViewPortMouseListener(DOWN_DIRECTION));
      button.setPreferredSize(new Dimension(10, 10));
      button.setIcon(ImageProvider.get("svpDown"));
      add(button, BorderLayout.SOUTH);
      buttons.add(button);
    }

    // LEFT
    if ((direction & LEFT_DIRECTION) > 0) {
      button = new JButton();
      button.addMouseListener(new ScrollViewPortMouseListener(LEFT_DIRECTION));
      button.setPreferredSize(new Dimension(10, 10));
      button.setIcon(ImageProvider.get("svpLeft"));
      add(button, BorderLayout.WEST);
      buttons.add(button);
    }

    // RIGHT
    if ((direction & RIGHT_DIRECTION) > 0) {
      button = new JButton();
      button.addMouseListener(new ScrollViewPortMouseListener(RIGHT_DIRECTION));
      button.setPreferredSize(new Dimension(10, 10));
      button.setIcon(ImageProvider.get("svpRight"));
      add(button, BorderLayout.EAST);
      buttons.add(button);
    }

    add(vp, BorderLayout.CENTER);

    this.addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent e) {
            showOrHideButtons();
          }
        });

    showOrHideButtons();

    timer.setRepeats(true);
    timer.setInitialDelay(400);
  }
Example #5
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmDish = new JFrame();
    frmDish.getContentPane().setBackground(Color.WHITE);
    frmDish.setTitle("Add New Dish");
    frmDish.setBounds(100, 100, 631, 436);
    frmDish.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frmDish.getContentPane().setLayout(null);

    txt_Recipe = new JTextField();
    txt_Recipe.setBounds(249, 59, 119, 30);
    frmDish.getContentPane().add(txt_Recipe);
    txt_Recipe.setColumns(10);

    JLabel lblRecipeName = new JLabel("Recipe Name");
    lblRecipeName.setBounds(132, 67, 93, 14);
    frmDish.getContentPane().add(lblRecipeName);

    cb_Rating = new JComboBox();
    cb_Rating.setModel(new DefaultComboBoxModel(new String[] {"1", "2", "3", "4", "5"}));
    cb_Rating.setBounds(249, 135, 119, 30);
    frmDish.getContentPane().add(cb_Rating);

    JLabel lblRating = new JLabel("Rating");
    lblRating.setBounds(132, 143, 46, 14);
    frmDish.getContentPane().add(lblRating);

    txt_Cousine = new JTextField();
    txt_Cousine.setBounds(249, 206, 119, 30);
    frmDish.getContentPane().add(txt_Cousine);
    txt_Cousine.setColumns(10);

    JLabel lblCousine = new JLabel("Cousine");
    lblCousine.setBounds(132, 214, 46, 14);
    frmDish.getContentPane().add(lblCousine);

    JButton btnNext = new JButton("Next");
    btnNext.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            AddToDatabase();
            Add_New_Recipe.run();
            frmDish.dispose();
          }
        });
    btnNext.setBounds(458, 335, 89, 23);
    frmDish.getContentPane().add(btnNext);

    JButton btnBack = new JButton("Back");
    btnBack.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            MainMenu.run();
            frmDish.dispose();
          }
        });
    btnBack.setBounds(28, 335, 89, 23);
    frmDish.getContentPane().add(btnBack);
  }
  public JFrameMain() {
    super("¿â´æ¹ÜÀí");
    getContentPane().setLayout(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    btn_transfer = new JButton("\u4ED3\u5E93\u8C03\u62E8");
    btn_transfer.addMouseListener(new MainFrame_btn_mouseListener(this));
    btn_transfer.setBackground(Color.YELLOW);
    btn_transfer.setBounds(59, 73, 93, 23);
    getContentPane().add(btn_transfer);

    btn_search = new JButton("\u62A5\u635F\u62A5\u6EA2");
    btn_search.addMouseListener(new MainFrame_btn_mouseListener(this));
    btn_search.setBackground(Color.MAGENTA);
    btn_search.setBounds(59, 135, 93, 23);
    getContentPane().add(btn_search);

    btn_loss = new JButton("\u8FC7\u671F\u67E5\u8BE2");
    btn_loss.addMouseListener(new MainFrame_btn_mouseListener(this));
    btn_loss.setBackground(Color.RED);
    btn_loss.setBounds(225, 73, 93, 23);
    getContentPane().add(btn_loss);

    btn_change = new JButton("\u5E93\u5B58\u53D8\u52A8");
    btn_change.addMouseListener(new MainFrame_btn_mouseListener(this));
    btn_change.setForeground(new Color(0, 0, 0));
    btn_change.setBackground(new Color(0, 255, 255));
    btn_change.setBounds(225, 135, 93, 23);
    getContentPane().add(btn_change);
  }
Example #7
0
  private void generateContent(JPanel buttonJP) {

    buttonJP.setLayout(new BoxLayout(buttonJP, BoxLayout.LINE_AXIS));
    buttonJP.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    JButton save = new JButton("Save");
    save.setSize(100, 50);
    save.setMaximumSize(save.getSize());
    save.addMouseListener(generateSaveMouseListener());
    save.setFocusable(false);

    JButton load = new JButton("Load");
    load.setSize(100, 50);
    load.setMaximumSize(load.getSize());
    load.addMouseListener(generateLoadMouseListener());
    load.setFocusable(false);

    this.fileNameTF = new JTextField();
    this.fileNameTF.setSize(190, 50);
    this.fileNameTF.setMaximumSize(this.fileNameTF.getSize());
    this.fileNameTF.setText("Mr.Freezer");

    buttonJP.add(save);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(load);
    buttonJP.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonJP.add(this.fileNameTF);
  }
Example #8
0
  public MenuPainel() {

    try {
      i = ImageIO.read(new File("21.jpg"));
    } catch (IOException e) {
      System.out.println(e.getMessage());
      System.exit(1);
    }

    this.setLayout(null);

    JButton newgame = new JButton("Iniciar Jogo");
    newgame.setBounds(20, 240, 200, 30);
    newgame.setName("NovoJogo");
    newgame.addMouseListener(tt);

    JButton rules = new JButton("Regras");
    rules.setBounds(20, 280, 200, 30);
    rules.setName("Regras");
    rules.addMouseListener(tt);

    JButton exit = new JButton("Sair");
    exit.setBounds(20, 320, 200, 30);
    exit.setName("Sair");
    exit.addMouseListener(tt);

    this.add(newgame);
    this.add(rules);
    this.add(exit);
  }
  public userListFrame() {
    super(defaults.uid);
    defaults.ULF = this;
    defaults.SQL = SQL;
    ID = defaults.idx;
    setIconImage(defaults.img.getImage());
    add(scroll);
    SNameList.add(new Message(defaults.uid, ID, 0));
    window.setLayout(new BoxLayout(window, BoxLayout.PAGE_AXIS));
    window.setMaximumSize(new Dimension(100, 1000));
    fF = new fileFrame();
    setResizable(false);
    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
    setVisible(true);
    SQL.retrieveUserList();
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    add(Mailbox);
    add(start);
    start.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (SNameList.size() > 0) {
              String idxs = "";
              ArrayList<String> uids = new ArrayList();
              ArrayList<Integer> idxList = new ArrayList();
              for (Message M : SNameList) {
                idxs += M.getSender() + ",";
                uids.add(M.getMessage());
                idxList.add(M.getSender());
              }
              idxs = idxs.substring(0, idxs.length() - 1);
              int group = SQL.findGroup(idxs, SNameList.size());
              System.out.println("SQLResult:" + group);
              if (group == 0) {
                defaults.output.send(new Message("", -4, 0));
                defaults.output.send(idxList);
                waitForGCon();
                group = SQL.findGroup(idxs, SNameList.size());
              }
              newConvo(group, uids);
            } else {
              JOptionPane.showMessageDialog(new JFrame(), "You must select a user!");
            }
          }
        });
    Mailbox.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            fF.setVisible(true);
          }
        });

    setSize(110, 500);
    repaint();
    validate();
  }
Example #10
0
  public SudokuGUI(String x) {
    setTitle(x);
    textfield1.setEditable(false);
    button5.setEnabled(false);
    button10.setEnabled(false);
    button13.setEnabled(false);
    button12.setEnabled(false);
    button15.setEnabled(false);
    button18.setEnabled(false);
    setLayout(new GridLayout(6, 4, 4, 4));
    setLocation(350, 300);

    button1.addMouseListener(this);
    button2.addMouseListener(this);
    button3.addMouseListener(this);
    button4.addMouseListener(this);
    button6.addMouseListener(this);
    button7.addMouseListener(this);
    button8.addMouseListener(this);
    button9.addMouseListener(this);
    button11.addMouseListener(this);
    button14.addMouseListener(this);
    button16.addMouseListener(this);
    button17.addMouseListener(this);
    button19.addMouseListener(this);
    button20.addMouseListener(this);
    textfield2.addMouseListener(this);

    add(button1);
    add(button2);
    add(button3);
    add(button4);
    add(button5);
    add(button6);
    add(button7);
    add(button8);
    add(button9);
    add(button10);
    add(button11);
    add(button12);
    add(button13);
    add(button14);
    add(button15);
    add(button16);
    add(button17);
    add(button18);
    add(button19);
    add(button20);
    add(textfield1);
    add(textfield2);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(700, 400);
  }
Example #11
0
  /** kreiert das Menü oben */
  private JToolBar createMenu() {
    JToolBar toolbar = new JToolBar();
    toolbar.setOrientation(SwingConstants.HORIZONTAL);
    toolbar.setFloatable(false);
    toolbar.setMargin(new Insets(2, 35, 2, 0));
    toolbar.setBackground(new Color(219, 255, 179));

    zoomIn = FsmUtils.createButton(zoomInImg);
    zoomIn.setToolTipText("Vergr��ern");
    zoomIn.addMouseListener(new ZoomInHandler(this));

    zoomOut = FsmUtils.createButton(zoomOutImg);
    zoomOut.setToolTipText("Verkleinern");
    zoomOut.addMouseListener(new ZoomOutHandler(this));

    layout = FsmUtils.createButton(layoutImg);
    layout.setToolTipText("Automatisch layouten");
    layout.addMouseListener(new LayoutHandler(this));

    deterministic = new JRadioButton("deterministisch");
    deterministic.setToolTipText("Der endliche Automat wird deterministisch");
    deterministic.setBackground(new Color(219, 255, 179));
    deterministic.addMouseListener(new TypeOfFsmHandler(this, false));

    nondeterministic = new JRadioButton("nichtdeterministisch");
    nondeterministic.setToolTipText("Der endliche Automat wird nichtdeterministisch");
    nondeterministic.setBackground(new Color(219, 255, 179));
    nondeterministic.addMouseListener(new TypeOfFsmHandler(this, true));

    ButtonGroup group = new ButtonGroup();
    group.add(deterministic);
    group.add(nondeterministic);
    if (this.getFsmProgram().isNondeterministic()) {
      group.setSelected(nondeterministic.getModel(), true);
    } else {
      group.setSelected(deterministic.getModel(), true);
    }

    toolbar.add(zoomIn);
    toolbar.add(Box.createHorizontalStrut(2));
    toolbar.add(zoomOut);
    toolbar.add(Box.createHorizontalStrut(2));
    toolbar.add(Box.createHorizontalStrut(2));
    toolbar.add(layout);
    toolbar.addSeparator();
    toolbar.add(deterministic);
    toolbar.add(nondeterministic);

    return toolbar;
  }
Example #12
0
  private void jbInit() throws Exception {
    // this.setResizable(false);
    this.setSize(ancho, alto);
    this.setLocation(0, 0);

    // this.setUndecorated(true);
    // this.getContentPane().setLayout(null);

    // limites de componentes
    labelFondo.setBounds(
        new Rectangle((int) (ancho / 5), 2 * (alto / 6), (int) (ancho / 1.5), alto / 4));
    botonCancelar.setBounds(
        new Rectangle(
            (int) (2.9 * (ancho / 5)), (int) (2 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonCancelar.setBorder(null);
    // botonAceptar.setBounds(new Rectangle(0, 0, 100, 30));
    botonAceptar.setBounds(
        new Rectangle(
            (int) (2.15 * (ancho / 5)), (int) (2 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonAceptar.setBorder(null);
    textNombre.setFont(new java.awt.Font("Serif", 3, 15));
    textNombre.setBounds(
        new Rectangle((int) (2.5 * (ancho / 5)), (int) (1.5 * (alto / 4)), ancho / 5, alto / 25));
    textNombre.addKeyListener(new PanelNick_textNombre_keyAdapter(this));

    textContra.setFont(new java.awt.Font("Serif", 3, 15));
    textContra.setBounds(
        new Rectangle(
            (int) (2.9 * (ancho / 5)), (int) (1.65 * (alto / 4)) + 20, ancho / 8, alto / 25));

    // imagenes de componentes
    labelFondo.setIcon(new ImageIcon("../imagenes/introduceNick.jpg"));
    botonCancelar.setIcon(new ImageIcon("../imagenes/botoncancelar.jpg"));
    botonCancelar.addMouseListener(new PanelNick_botonCancelar_mouseAdapter(this));
    botonAceptar.setIcon(new ImageIcon("../imagenes/botonaceptar.jpg"));
    botonAceptar.addMouseListener(new PanelNick_botonAceptar_mouseAdapter(this));

    // agregar componentes al panel
    this.add(textContra, null);
    this.add(botonCancelar, null);
    this.add(botonAceptar, null);
    this.add(textNombre, null);
    this.add(labelFondo, null);

    // acciones de botones
    botonAceptar.addActionListener(new PanelNick_botonAceptar_actionAdapter(this));
    botonCancelar.addActionListener(new PanelNick_botonCancelar_actionAdapter(this));
  }
 private void setMovable(final JFrame frame) {
   String titlePath = "img/Title/";
   JButton title = new JButton(new ImageIcon(titlePath + frameName + ".png"));
   title.addMouseListener(
       new MouseAdapter() {
         public void mousePressed(MouseEvent e) {
           CommonFrame.origin.x = e.getX();
           CommonFrame.origin.y = e.getY();
         }
       });
   title.addMouseMotionListener(
       new MouseMotionAdapter() {
         public void mouseDragged(MouseEvent e) {
           Point p = frame.getLocation();
           frame.setLocation(p.x + e.getX() - origin.x, p.y + e.getY() - origin.y);
         }
       });
   if (frameName.equals("LoginFrame")) {
     title.setBounds(30, 30, 900, 82);
   } else {
     title.setBounds(30, 30, 800, 70);
   }
   title.setBorderPainted(false);
   title.setFocusable(false);
   add(title);
 }
Example #14
0
  public static void main(String[] args) {

    JFrame frame = new JFrame();
    JLayeredPane lp = new JLayeredPane();
    JLabel label1 = new JLabel("Ïteracyjnie: ");
    JLabel label2 = new JLabel("Rekurencyjnie: ");
    JButton button = new JButton("Nie chce dluzej czekac");

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(300, 100);
    frame.setVisible(true);
    lp.setLayout(new BoxLayout(lp, BoxLayout.PAGE_AXIS));

    frame.add(lp);
    lp.add(label1);
    lp.add(label2);
    lp.add(button);

    FactorialRecursively r = new FactorialRecursively(FACTORIAL_OF);
    FactorialIteratively i = new FactorialIteratively(FACTORIAL_OF);

    r.run();
    i.run();

    label1.setText("Iteracyjnie: " + i.getValue());
    label2.setText("Rekurencyjnie: " + r.getValue());

    button.addMouseListener(
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            i.interrupt();
            r.interrupt();
          }
        });
  }
Example #15
0
  /**
   * Installs a Tool in the Toolbar
   *
   * @param toolbar as JToolbar
   * @param tool, Tool to install
   */
  public void installToolInToolBar(JToolBar toolbar, final Tool tool) {
    final JButton button;
    button = new JButton();

    button.setMargin(new Insets(0, 0, 0, 0));

    if (tool.getItemType() != null) {
      button.setIcon(tool.getItemType().getIcon());
      button.setToolTipText(tool.getItemType().getDescription());

    } else {
      button.setText("Tool"); // For Debugging
    }
    toolbar.add(button);
    toolButtons.add(button);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.setTool(tool, button);
          }
        });
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(true);
          }

          public void mouseExited(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(false);
          }
        });
  }
Example #16
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;
  }
Example #17
0
  private JButton getUpdateButton() {
    if (updateButton == null) {
      updateButton = new JButton();
      updateButton.setText("Update Values");
      updateButton.addMouseListener(
          new MouseListener() {

            public void mouseClicked(MouseEvent e) {
              HttpCom.send(
                  url + "report.php",
                  new String[][] {
                    new String[] {"action", "cparams"},
                    new String[] {"str_len", String.valueOf(strSlider.getValue())},
                    new String[] {"dest_thres", String.valueOf(destSlider.getValue())},
                    new String[] {"time_thres", String.valueOf(timeSlider.getValue())}
                  });
            }

            public void mousePressed(MouseEvent mouseevent) {}

            public void mouseReleased(MouseEvent mouseevent) {}

            public void mouseEntered(MouseEvent mouseevent) {}

            public void mouseExited(MouseEvent mouseevent) {}
          });
    }
    return updateButton;
  }
  private void initFrame() {
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setLayout(new FlowLayout());
    this.getContentPane().add(mouseButton);

    // Add a MouseListener to the JButton
    mouseButton.addMouseListener(
        new MouseListener() {
          @Override
          public void mouseClicked(MouseEvent e) {}

          @Override
          public void mousePressed(MouseEvent e) {}

          @Override
          public void mouseReleased(MouseEvent e) {}

          @Override
          public void mouseEntered(MouseEvent e) {
            mouseButton.setText("Mouse has entered!");
          }

          @Override
          public void mouseExited(MouseEvent e) {
            mouseButton.setText("Mouse has exited!");
          }
        });
  }
Example #19
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;
  }
  private JButton createExampleButton(final CommonApp commonApp) {
    String iconResource = commonApp.getIconResource();
    Icon icon =
        iconResource == null
            ? new EmptyIcon()
            : new ImageIcon(getClass().getResource(iconResource));
    JButton button =
        new JButton(
            new AbstractAction(commonApp.getName(), icon) {
              public void actionPerformed(ActionEvent e) {
                commonApp.init(OptaPlannerExamplesApp.this, false);
              }
            });
    button.setHorizontalAlignment(JButton.LEFT);
    button.setHorizontalTextPosition(JButton.RIGHT);
    button.setVerticalTextPosition(JButton.CENTER);
    button.addMouseListener(
        new MouseAdapter() {

          public void mouseEntered(MouseEvent e) {
            descriptionTextArea.setText(commonApp.getDescription());
          }

          public void mouseExited(MouseEvent e) {
            descriptionTextArea.setText("");
          }
        });
    return button;
  }
  /**
   * Description of the Method
   *
   * @exception Exception Description of Exception
   */
  private void jbInit() throws Exception {

    this.setLayout(null);
    this.setSize(700, 500);
    this.setLocation(0, 0);

    // limites de componentes
    labelFondo.setBounds(new Rectangle((int) (ancho / 3.5), 2 * (alto / 6), ancho / 2, alto / 4));

    botonAceptar.setBounds(
        new Rectangle(
            (int) (2.4 * (ancho / 5)), (int) (1.9 * (alto / 4)), (int) (ancho / 10.2), alto / 25));
    botonAceptar.setBorder(null);

    // imagenes de componentes
    labelFondo.setIcon(new ImageIcon(Imagen));

    botonAceptar.setIcon(new ImageIcon("../imagenes/botonaceptar.jpg"));
    botonAceptar.addMouseListener(new PanelGenerico_botonAceptar_mouseAdapter(this));

    // agregar componentes al panel

    this.add(botonAceptar, null);
    this.add(labelFondo, null);
    this.setBackground(SystemColor.menuText);

    // acciones de botones
    botonAceptar.addActionListener(new PanelGenerico_botonAceptar_actionAdapter(this));
  }
Example #22
0
  public SplitButton(final Icon icon) {
    mainText = new JLabel(icon);
    final JLabel menuIcon = new JLabel("\u25be");
    super.setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    super.add(mainText);
    super.add(Box.createRigidArea(new Dimension(GAP, 0)));
    super.add(new JSeparator(JSeparator.VERTICAL));
    super.add(Box.createRigidArea(new Dimension(GAP, 0)));
    super.add(menuIcon);

    super.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(final MouseEvent e) {
            if (!SplitButton.this.isEnabled()) return;
            final int x = e.getX();
            final int w = e.getComponent().getWidth();
            if (x >= (2 * w / 3)) {
              actionListenersEnabled = false;
              if (menu != null) {
                menu.show(e.getComponent(), e.getX(), e.getY());
              }
            } else {
              actionListenersEnabled = true;
            }
          }
        });
  }
  public JButton getCertificadojButton() {
    if (certificadojButton == null) {
      certificadojButton = new JButton();

      certificadojButton.setText(
          I18N.get("RegistroExpedientes", "Catastro.webservices.password.trustStore.buscar"));

      certificadojButton.addMouseListener(
          new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent e) {

              fileCertificado = new JFileChooser();

              GeopistaFiltroFicheroFilter filter = new GeopistaFiltroFicheroFilter();
              filter.addExtension("pfx");
              filter.setDescription(
                  I18N.get("RegistroExpedientes", "Catastro.webservices.certificado.pkcs12"));
              fileCertificado.setFileFilter(filter);
              fileCertificado.setFileSelectionMode(0);
              fileCertificado.setAcceptAllFileFilterUsed(false);

              int returnVal = fileCertificado.showOpenDialog(aplicacion.getMainFrame());
              if (returnVal == JFileChooser.APPROVE_OPTION) {
                setKeystoreFile(new File(fileCertificado.getSelectedFile().getPath()));
                certificadoField.setText(getKeystoreFile().getPath());
              } else {
                certificadoField.setText("");
              }
            }
          });
    }
    return certificadojButton;
  }
 LookManager(JButton arrowbutton, PopupPanel popuppanel) {
   arrow = arrowbutton;
   popup = popuppanel;
   popup.addPopupMenuListener(this);
   initButton(arrow);
   arrow.addMouseListener(this);
 }
Example #25
0
 public static void main(String[] args) {
   okno = new JFrame("Uciekajacy button");
   okno.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   okno.setSize(800, 600);
   okno.setResizable(false);
   panel = new JLayeredPane();
   przycisk = new JButton("( ͡° ͜ʖ ͡°)");
   przycisk.addMouseListener(
       new MouseAdapter() {
         public void mouseEntered(MouseEvent evt) {
           przycisk.setLocation(
               new Point((int) (Math.random() * 700), (int) (Math.random() * 500)));
         }
       });
   przycisk.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent ae) {
           JOptionPane.showMessageDialog(okno, "Przycisk został naciśnięty!");
         }
       });
   przycisk.setBounds(350, 200, 80, 30);
   panel.add(przycisk);
   okno.add(panel);
   okno.setVisible(true);
 }
Example #26
0
  public GuideFrame() {

    setTitle("Portal");
    setSize(510, 95);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

    // Determine the new location of the window
    int w = this.getSize().width;
    int h = this.getSize().height;
    int x = (dim.width - w) / 2;
    int y = (dim.height - h) / 2;

    // Move the window
    this.setLocation(x, y);

    GuidePanel portalPanel = new GuidePanel();
    portalPanel.setName("shit");

    add(portalPanel);

    for (final JButton j : GuidePanel.bList) {
      j.addMouseListener(this);
    }
  }
  private JButton createExampleButton(
      final String title, final String description, String iconResource, final Runnable runnable) {
    ImageIcon icon =
        iconResource == null ? null : new ImageIcon(getClass().getResource(iconResource));
    JButton button =
        new JButton(
            new AbstractAction(title, icon) {
              public void actionPerformed(ActionEvent e) {
                runnable.run();
              }
            });
    button.setHorizontalTextPosition(JButton.CENTER);
    button.setVerticalTextPosition(JButton.BOTTOM);
    button.addMouseListener(
        new MouseAdapter() {

          public void mouseEntered(MouseEvent e) {
            descriptionTextArea.setText(description);
          }

          public void mouseExited(MouseEvent e) {
            descriptionTextArea.setText("");
          }
        });
    return button;
  }
Example #28
0
  // init
  public CouponPanel(JFrame frame) throws IOException, JSONException {
    super(new BorderLayout());

    this.frame = frame;

    // VUDAO MUST SET
    this.userID = 1; // HOANG SET 1 FOR TESTING
    this.interacterGUI = new InteracterGUI(userID);

    // step 2
    this.interacterGUI.readNewCoupon();

    // step 5

    if (interacterGUI.checkUserHistory() == false) {
      // go to step 6 and step 7

      allNewCoupons = interacterGUI.returnCoupons();
    } else {
      // go to step 8 and 9
      System.out.println("Go herexXXXXXXXXXXXXXXXXX");
      allNewCoupons = interacterGUI.couponRecommend();
    }

    // step 6 + 10

    // allNewCoupons = interacterGUI.returnCoupons();

    // step: 7
    // Create the check boxes.
    for (int i = 0; i < allNewCoupons.size(); i++) {
      String[] coupons = allNewCoupons.get(i);

      JCheckBox jCheckBox = new JCheckBox(coupons[1]);
      arrayCheckBox.add(jCheckBox);
    }

    submitButton = new JButton();
    submitButton.setText("submit");

    submitButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            submitButtonMouseClicked(e);
          }
        });

    /*Put the check boxes in a column in a panel*/

    JPanel checkPanel = new JPanel(new GridLayout(0, 1));
    for (int i = 0; i < arrayCheckBox.size(); i++) {
      checkPanel.add(arrayCheckBox.get(i));
    }
    checkPanel.add(submitButton);

    add(checkPanel, BorderLayout.LINE_START);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
  }
 /**
  * Creates a JButton.
  *
  * @param Default text for the button
  * @return The JButton Object
  */
 private JButton createButton(String text) {
   JButton b = new JButton();
   b.setText(text);
   b.setBackground(java.awt.Color.orange);
   b.addMouseListener(buttonEvents);
   b.addMouseMotionListener(buttonEvents);
   return b;
 }
Example #30
0
  /**
   * Create a component that will replace the spinner models value with the object returned by
   * <code>spinner.getPreviousValue</code>. By default the <code>previousButton</code> is a JButton
   * who's <code>ActionListener</code> updates it's <code>JSpinner</code> ancestors model. If a
   * previousButton isn't needed (in a subclass) then override this method to return null.
   *
   * @return a component that will replace the spinners model with the next value in the sequence,
   *     or null
   * @see #installUI
   * @see #createNextButton
   */
  protected Component createPreviousButton() {
    if (LookUtils.IS_LAF_WINDOWS_XP_ENABLED) return super.createPreviousButton();

    JButton b = new WindowsArrowButton(SwingConstants.SOUTH);
    b.addActionListener(PREVIOUS_BUTTON_HANDLER);
    b.addMouseListener(PREVIOUS_BUTTON_HANDLER);
    return b;
  }