public SchiebePuzzle() {
    JFrame jF = new JFrame("Misc_2015/SchiebePuzzle");
    jF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    jF.setLayout(new GridLayout(YY, XX)); // ggf zu ändern
    try {
      BufferedImage fuYou = ImageIO.read(new File("fuYou.jpg"));
      int w = fuYou.getWidth();
      int h = fuYou.getHeight();
      for (int y = 0; y < YY; y++)
        for (int x = 0; x < XX; x++) {
          buttons[y][x] =
              new PuzzButton(
                  new ImageIcon(fuYou.getSubimage(x * (w / XX), y * (h / YY), w / XX, h / YY)));

          buttons[y][x].setBorder(new LineBorder(Color.BLACK, 1));
          buttons[y][x].setActionCommand("" + x + y);
          buttons[y][x].setName("" + x + y);
          buttons[y][x].setPosY(y);
          buttons[y][x].setPosX(x);
          buttons[y][x].addActionListener(this);
          jF.add(buttons[y][x]);
        }

    } catch (IOException e) {
      System.out.println("Bild nicht gefunden!");
    }

    jF.pack();
    jF.setVisible(true);
  }
  public void go() {
    picture();
    ActionListener listener = new BtListener();
    go.addActionListener(listener);
    btn_update_manual.addActionListener(listener);
    go.setForeground(Color.black);
    // rights.setFont((new Font("Arial", Font.PLAIN, 12)));
    title.setFont((new Font("Arial", Font.BOLD, 36)));
    title.setForeground(new Color(238, 253, 253));
    today.setFont((new Font("Arial", Font.BOLD, 16)));
    today.setForeground(new Color(163, 184, 204));
    frame.setLayout(new BorderLayout());
    from.setBackground(Color.white);
    to.setBackground(Color.white);
    converted.setFont(new Font("Arial", Font.BOLD, 24));
    converted.setForeground(new Color(238, 253, 253));
    Lfrom.setForeground(new Color(238, 253, 253));
    Lto.setForeground(new Color(238, 253, 253));
    quantity.setForeground(new Color(238, 253, 253));
    Lfrom.setFont(new Font("Arial", Font.BOLD, 24));
    Lto.setFont(new Font("Arial", Font.BOLD, 24));
    quantity.setFont(new Font("Arial", Font.BOLD, 24));
    north.setLayout(new FlowLayout());
    north.add(title);
    north.setBackground(new Color(59, 62, 71));
    frame.add(BorderLayout.NORTH, north);
    inner.setLayout(new BorderLayout());
    inner.add(BorderLayout.NORTH, today);
    inner.add(BorderLayout.WEST, picPanel);
    center.setLayout(new GridLayout(2, 4, 5, 5));
    center.add(Lfrom);
    center.add(from);
    center.add(Lto);
    center.add(to);
    center.add(quantity);
    center.add(amount);
    center.add(go);
    inner.setBackground(new Color(59, 62, 71));
    inner.add(BorderLayout.SOUTH, center);
    center.setBackground(new Color(59, 62, 71));
    frame.add(BorderLayout.CENTER, inner);
    south.setBackground(new Color(59, 62, 71));
    south.setLayout(new FlowLayout());
    south.add(converted);
    south.add(answer);
    south.add(btn_update_manual);
    // south.add(rights);
    frame.add(BorderLayout.SOUTH, south);
    frame.setSize(850, 700);
    frame.setVisible(true);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent event) {
            frame.setVisible(false);
            frame.dispose();
            System.exit(0);
          }
        });
  }
  // -------------------------------------------------------------------
  public static void main(String[] args) {
    // Create the window
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(new Dimension(300, 100));
    frame.setTitle("A frame");
    frame.setLayout(new FlowLayout()); // This will be discuss in the next lesson

    // Create and add the first button
    JButton button1 = new JButton();
    button1.setText("I'm a button.");
    button1.setBackground(Color.BLUE);
    frame.add(button1);

    // Create and add the second button
    JButton button2 = new JButton();
    button2.setText("Click me!");
    button2.setBackground(Color.RED);
    frame.add(button2);

    // Reset the sizes of the buttons and window
    frame.pack();

    // Actually put the window on the screen and draw all its components
    frame.setVisible(true);
  }
  /** Displays the character window */
  public void characterWindow() {
    if (characterWindow != null) {
      characterWindow.dispose();
    }
    characterWindow = new JFrame("Character");
    characterWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    JTextField health = new JTextField(player.health());
    health.setEditable(false);

    JButton weapon = new JButton(player.weapon().split(" ")[1]);
    if (player.weapon().split(" ")[1].equals("none")) {
      weapon.setEnabled(false);
    }
    weapon.addActionListener(this);

    JButton armor = new JButton(player.armor().split(" ")[1]);
    if (player.armor().split(" ")[1].equals("none")) {
      armor.setEnabled(false);
    }
    armor.addActionListener(this);

    characterWindow.setBounds(
        mainWindow.getX() + mainWindow.getWidth(), mainWindow.getY(), 200, 150);
    characterWindow.setResizable(false);
    characterWindow.setLayout(new GridLayout(3, 1));
    characterWindow.add(health);
    characterWindow.add(weapon);
    characterWindow.add(armor);

    characterWindow.setVisible(true);
  }
  public ObserverPattern() {
    root = null;
    // window = new JFrame();
    width = 400;
    height = 400;

    window = new JFrame("New Window");
    // controllwin =  new JFrame("Controll");
    // controllwin.setLayout(new FlowLayout());
    JButton b = new JButton("Értéket ad");
    tf = new JTextField();

    b.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // controlwindow.removeAll();
            if (!ertad()) {
              tf.setText("Nem megfelelo parameter!!");
            }
          }
        });

    /*controllwin.add(tf);
    controllwin.add(b);
    controllwin.setSize(100,50);
    controllwin.setVisible(true);
    controllwin.pack();*/

    window.setLayout(new FlowLayout());
    window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    window.setSize(width, height);
    window.setVisible(true);
  }
Exemple #6
0
  // Main init
  private void init() {
    fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    fenetre.setBounds(
        LARG_ECRAN / 2 - LARG_FENETRE / 2,
        HAUT_ECRAN / 2 - HAUT_FENETRE / 2,
        LARG_FENETRE,
        HAUT_FENETRE);
    fenetre.setResizable(false);
    fenetre.setLayout(null);

    // ajout d'un ecouteur a la fenetre
    fenetre.addWindowListener(this);

    initPanneauHaut();
    initPanneauMillieu();
    initPanneauBas();

    initLabels();

    initPanneauHautComponents();
    initPanneauMillieuComponents();
    initPanneauBasComponents();
    ajouterAFenetre();

    modeConsultation();

    ajouterActionListener();

    // derniere instruction
    fenetre.setVisible(true);
  }
  public MenuPrincipalVista() {

    JButton btnSalir = new JButton("0. Sortir");
    JButton btnMenuParc = new JButton("1. Menú parc d'atraccions");
    JButton btnMenuAtraccions = new JButton("2. Menú atraccions");
    JButton[] arrayBotones = {btnSalir, btnMenuParc, btnMenuAtraccions};
    setMenuButtons(arrayBotones);

    GridLayout layoutGrid = new GridLayout(0, 1);
    frame = new JFrame("Menu Principal");
    frame.setLayout(layoutGrid);

    for (JButton menuButton : menuButtons) {
      frame.add(menuButton);
    }

    frame.setSize(amplada, alcada);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    /*
    Amb les propietats d'aquesta classe, heu de fer el següent (no afegiu cap listener a cap control)
        Heu de crear l'objecte JFrame amb títol "Menú Principal" i layout Grid d'una columna
        Heu de crear els botons del formulari. Cada botó serà un element de l'array de botons amb les següents etiquetes:
                    "0. Sortir"
                    "1. Menú parc d'atraccions"
                    "2. Menú atraccions"
        Heu d'afegir-ho tot al frame
        Heu de fer visible el frame amb l'amplada i alçada que proposen les propietats d'aquest nom
        Heu de fer que la finestra es tanqui quan l'usuari ho fa amb el control "X" de la finestra
    */
  }
 /** Displays the inventory window */
 public void inventoryWindow() {
   if (inventoryWin != null) {
     inventoryWin.dispose();
   }
   inventoryWin = new JFrame("Inventory");
   inventoryWin.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
   Inventory inv = player.getInventory();
   int y = inv.getSize();
   if (y == 0) {
     displayMessage("Inventory is empty");
     return;
   }
   int cols = 2;
   int rows = (y - y % cols) / cols;
   if (y % cols != 0) rows = rows + 1;
   inventoryWin.setLayout(new GridLayout(0, cols * 2));
   for (int i = 0; i < y; i++) {
     JButton b = new JButton(inv.getItem(i).getName());
     inventoryWin.add(b);
     b.addActionListener(this);
     JButton d = new JButton("drop " + inv.getItem(i).getName());
     inventoryWin.add(d);
     d.addActionListener(this);
   }
   // inventoryWin.setBounds(350, 0, 300, 80*rows);
   inventoryWin.setLocation(mainWindow.getX(), mainWindow.getY() + mainWindow.getHeight());
   inventoryWin.pack();
   inventoryWin.setVisible(true);
 }
  @Override
  public void display(HashBasedTable<String, String, Double> data) {

    roomToCodeMapping = generateNewRoomToCodeMapping();
    dataSet = createDataSet(data);
    final JFreeChart chart = createChart(dataSet);
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(1000, 540));
    createNewFrameAndSetLocation();
    currentFrame.setTitle(this.getTitle());
    currentFrame.setContentPane(chartPanel);
    currentFrame.setVisible(true);
    currentFrame.setSize(new Dimension(1020, 560));
    currentFrame.addWindowListener(this);

    if (type == MarkovDataDialog.HeatMapType.COMPARISON) {
      unscaledDifferenceSlider.setLabelTable(unscaledDifferenceSlider.createStandardLabels(5, 5));
      differenceSelectorFrame = new JFrame("Choose Size of difference");
      differenceSelectorFrame.setLayout(new BorderLayout());
      differenceSelectorFrame.add(unscaledDifferenceSlider, BorderLayout.NORTH);

      statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
      statusLabel.setText("Current difference size:" + this.unscaledDifference);

      differenceSelectorFrame.add(statusLabel, BorderLayout.CENTER);

      differenceSelectorFrame.add(regenerate, BorderLayout.SOUTH);

      regenerate.addActionListener(this);

      differenceSelectorFrame.setLocation(100, 10);
      differenceSelectorFrame.setSize(300, 200);
      differenceSelectorFrame.setVisible(true);
    }
  }
Exemple #10
0
  public static void main(String[] args) {
    if (Platform.get() != Platform.WINDOWS)
      throw new UnsupportedOperationException("This demo can only run on Windows.");

    LWJGLCanvas canvas = new LWJGLCanvas();
    canvas.setSize(640, 480);

    JFrame frame = new JFrame("JAWT Demo");

    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosed(WindowEvent e) {
            canvas.destroy();
          }
        });

    KeyboardFocusManager.getCurrentKeyboardFocusManager()
        .addKeyEventDispatcher(
            e -> {
              if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                frame.dispose();
                return true;
              }

              return false;
            });

    frame.setLayout(new BorderLayout());
    frame.add(canvas, BorderLayout.CENTER);

    frame.pack();
    frame.setVisible(true);
  }
 Main() {
   f = new JFrame("Wiki Seach");
   JPanel p = new JPanel();
   JPanel p1 = new JPanel();
   b = new JButton("Search");
   b1 = new JButton("Exit");
   t = new JTextField(30);
   b.addActionListener(this);
   b1.addActionListener(this);
   p1.add(b);
   p1.add(b1);
   p.add(t);
   f.setLayout(new GridLayout(2, 1));
   f.add(p);
   f.add(p1);
   f.pack();
   f.setLocationRelativeTo(null);
   f.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   f.setVisible(true);
 }
Exemple #12
0
  public static void main(String[] args) {
    JFrame frame = new JFrame("Reaction Timer");
    frame.setSize(280, 120);

    final TextField disp = new TextField();
    final JButton btn = new JButton("Go");

    btn.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            u = System.currentTimeMillis();
            if (u - t < ONE_SECOND) {
              disp.setText("" + (u - t));
            }
            t = u;
          }
        });

    frame.setLayout(null);
    disp.setBounds(10, 10, 230, 20);
    frame.add(disp);
    btn.setBounds(10, 40, 210, 40);
    frame.add(btn);

    frame.setVisible(true);
    frame.setLocationRelativeTo(null);
    frame.setResizable(false);
  }
Exemple #13
0
  public start() {

    MyModel lm = new MyModel();
    JList<Integer> jl = new JList<>(lm);
    JButton b = new JButton("ADD");
    b.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            lm.add(zahl++);
          }
        });

    JFrame jf = new JFrame("List Test");
    jf.setLayout(new BorderLayout());
    jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JScrollPane scrollen = new JScrollPane(jl);

    jf.add(b, BorderLayout.SOUTH);
    jf.add(scrollen, BorderLayout.NORTH);
    jf.setSize(300, 300);
    jf.setLocation(400, 500);
    jf.setVisible(true);
  }
 public RemoveFrame() {
   frame = new JFrame("Select Files you wish to Remove from Drive");
   frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
   frame.getRootPane().setDefaultButton(confirm);
   try {
     files = DriveList.list();
   } catch (IOException e) {
     files = new ArrayList<File>();
   }
   confirm = new JButton("Remove");
   quit = new JButton("Cancel");
   confirm.addActionListener(this);
   quit.addActionListener(this);
   frame.setLayout(new BorderLayout());
   checkPanel = new JPanel();
   control = new JPanel();
   control.setLayout(new GridLayout(1, 2));
   control.add(confirm);
   control.add(quit);
   frame.add(control, BorderLayout.SOUTH);
   drawCheckPanel();
   frame.add(checkPanel, BorderLayout.CENTER);
   frame.pack();
   frame.setVisible(true);
 }
 public void editContactWindow() {
   editWindow = new JFrame("Edit Contacts");
   editWindow.setLayout(new FlowLayout());
   // Add List
   editWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
   editWindow.pack();
   editWindow.setVisible(true);
 }
Exemple #16
0
 private void initHeader() {
   NacitaciOkno = new JFrame();
   NacitaciOkno.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   NacitaciOkno.setTitle("Synchronizace dat");
   NacitaciOkno.setLocation(400, 350);
   NacitaciOkno.setSize(400, 200);
   NacitaciOkno.setLayout(null);
 }
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.JFrame#setLayout(java.awt.LayoutManager)
  */
 @Override
 public void setLayout(LayoutManager manager) {
   if (manager.getClass() != RibbonFrameLayout.class) {
     LayoutManager currManager = getLayout();
     if (currManager != null) {
       throw new IllegalArgumentException("Can't set a custom layout manager on JRibbonFrame");
     }
   }
   super.setLayout(manager);
 }
 public void toSendWindow() {
   toWindow = new JFrame("Send Email To");
   toWindow.setLayout(new BorderLayout());
   contactList = new ContactListCheckBox(cList);
   toWindow.add(contactList, BorderLayout.CENTER);
   toWindow.add(addSendContacts, BorderLayout.SOUTH);
   toWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
   toWindow.pack();
   toWindow.setVisible(true);
 }
Exemple #19
0
  public JFrame buildFrame() {

    f = new JFrame("AMSA World");
    f.setSize(800, 600);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLayout(new GridBagLayout());

    textArea.setFocusable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    ActionListener listener =
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            checkInput();
          }
        };
    inputText.addActionListener(listener);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1.0;
    c.gridwidth = 3;
    c.weighty = 0.025;
    c.gridx = 0;
    c.gridy = 0;
    f.add(topPanel, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy = 1;
    f.add(scrollPane, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 1;
    c.gridx = 2;
    c.gridy = 1;
    f.add(sidePanel, c);
    sidePanel.setVisible(false);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weighty = 0.025;
    c.gridwidth = 3;
    c.gridx = 0;
    c.gridy = 2;
    f.add(inputText, c);

    f.setVisible(true);

    return f;
  }
 public void removeContactWindow() {
   removeWindow = new JFrame("Remove Contacts");
   removeWindow.setLayout(new BorderLayout());
   contactList = new ContactListCheckBox(cList);
   removeWindow.add(contactList, BorderLayout.CENTER);
   // Add List here
   removeWindow.add(deleteContact, BorderLayout.SOUTH);
   removeWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
   removeWindow.pack();
   removeWindow.setVisible(true);
 }
 public void construirVentana() {
   jfrVentana = new JFrame("CARACETERES ESPECIALES EN EL TEXTO");
   jfrVentana.setLayout(new BoxLayout(jfrVentana.getContentPane(), BoxLayout.Y_AXIS));
   jfrVentana.add(pnlSuperior);
   jfrVentana.add(pnlInferior);
   jfrVentana.pack();
   jfrVentana.setResizable(false);
   jfrVentana.setVisible(true);
   jfrVentana.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   jfrVentana.setBounds(4, 5, 500, 400);
 }
  public static void main(String[] args) {
    frame.setLayout(new FlowLayout());

    final JPanel sceneHolder = new JPanel();
    initialize(sceneHolder);
    frame.add(sceneHolder);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(700, 700);
    frame.setVisible(true);
  }
Exemple #23
0
  public void CreateFrame() throws IOException {

    makeFrame();

    JFrame f;
    f = new JFrame();
    // f.setSize(1300, 800);
    f.setLayout(new BorderLayout());
    f.add(panel);
    f.pack();
    f.setVisible(true);
  }
Exemple #24
0
  public static void main(String[] args) {

    final JFrame frame = new JFrame();
    frame.setBounds(100, 100, 1200, 800);
    frame.setLayout(null);
    final VirtualFrame subFrame = new VirtualFrame(20, 20, 1160, 740);
    subFrame.setTitle("Scrolling test");
    frame.add(subFrame);
    frame.setVisible(true);

    final TextScroller scroller =
        new TextScroller(25, VirtualFrame.DEFAULT_BAR_THICKNESS + 25, 400, 650);
    subFrame.add(scroller);
    scroller.addLabel("A________________", "Arial", 1, 25);
    scroller.addLabel("B________________", "Arial", 1, 15);
    scroller.addLabel("C________________", "Arial", 1, 20);
    scroller.addLabel("D________________", "Arial", 1, 25);
    scroller.addLabel("E________________", "Arial", 1, 15);
    scroller.addLabel("F________________", "Arial", 1, 20);
    scroller.addLabel("G________________", "Arial", 1, 25);
    scroller.addLabel("H________________", "Arial", 1, 15);
    scroller.addLabel("I________________", "Arial", 1, 20);
    scroller.addLabel("J________________", "Arial", 1, 25);
    scroller.addLabel("K________________", "Arial", 1, 15);
    scroller.addLabel("L________________", "Arial", 1, 20);
    scroller.addLabel("M________________", "Arial", 1, 25);
    scroller.addLabel("N________________", "Arial", 1, 15);
    scroller.addLabel("O________________", "Arial", 1, 20);
    scroller.addLabel("P________________", "Arial", 1, 25);
    scroller.addLabel("Q________________", "Arial", 1, 15);
    scroller.addLabel("R________________", "Arial", 1, 20);
    scroller.addLabel("S________________", "Arial", 1, 25);
    scroller.addLabel("T________________", "Arial", 1, 15);
    scroller.addLabel("U________________", "Arial", 1, 20);
    scroller.addLabel("V________________", "Arial", 1, 25);
    scroller.addLabel("W________________", "Arial", 1, 15);
    scroller.addLabel("X________________", "Arial", 1, 20);
    scroller.addLabel("Y________________", "Arial", 1, 25);
    scroller.addLabel("Z________________", "Arial", 1, 15);
    scroller.addLabel("AA_______________", "Arial", 1, 25);
    scroller.addLabel("BB_______________", "Arial", 1, 15);
    scroller.addLabel("CC_______________", "Arial", 1, 20);
    scroller.addLabel("DD_______________", "Arial", 1, 25);
    scroller.addLabel("EE_______________", "Arial", 1, 15);
    scroller.addLabel("FF_______________", "Arial", 1, 20);
    scroller.addLabel("GG_______________", "Arial", 1, 25);
    scroller.addLabel("HH_______________", "Arial", 1, 15);
    scroller.addLabel("II_______________", "Arial", 1, 20);
    scroller.initialize();
  }
Exemple #25
0
 public GUI() {
   frame.setSize(500, 450);
   frame.setResizable(false);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   teksti.setEditable(false);
   loki = new JScrollPane(teksti);
   frame.setLocationRelativeTo(null);
   asetaLayout();
   panelv.setLayout(layout);
   frame.setLayout(new BorderLayout());
   frame.add(panelv, BorderLayout.WEST);
   frame.add(panelo, BorderLayout.CENTER);
   frame.setVisible(true);
 }
Exemple #26
0
  public void launchFrame() {
    JFrame frame = new JFrame("Mensajero");
    frame.setLayout(new BorderLayout());
    frame.add(Salida, BorderLayout.CENTER);
    frame.add(Entrada, BorderLayout.SOUTH);

    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(2, 1));
    p1.add(Enviar);
    p1.add(Salir);

    frame.addWindowListener(new CerrarHandler());
    frame.add(p1, BorderLayout.EAST);
    frame.pack();
    frame.setVisible(true);
  }
Exemple #27
0
  Jf() {

    j.setBounds(500, 40, 500, 500);
    j.setVisible(true);
    j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    j.setLayout(null);
    ImageIcon image = new ImageIcon("im1.jpg");
    JLabel l = new JLabel(image);
    int m = image.getIconWidth();
    int m1 = image.getIconHeight();
    j.setResizable(false); // frame resize nahi hoga	
    l.setBounds(0, 0, m, m1);
    j.add(l);
    l.add(linfo);
    l.add(lid);
    l.add(fid);
    l.add(lpass);
    l.add(fpass);
    fpass.setEchoChar('*');

    l.add(blogin);
    l.add(bnewaccount);
    l.add(bforget);

    ImageIcon image1 = new ImageIcon("logo1.png");
    JLabel limage = new JLabel(image1);
    l.add(limage);
    limage.setBounds(10, 50, 190, 130);

    Font f = new Font("ALGERIAN", Font.BOLD, 20);
    linfo.setFont(f);
    linfo.setBounds(40, 10, 420, 30);
    lid.setBounds(210, 50, 70, 30);
    fid.setBounds(290, 50, 150, 30);
    lpass.setBounds(210, 90, 70, 30);
    fpass.setBounds(290, 90, 150, 30);
    blogin.setBounds(210, 130, 100, 50);
    bnewaccount.setBounds(320, 130, 160, 20);
    bforget.setBounds(320, 160, 160, 20);
    blogin.setBackground(Color.green);
    bnewaccount.setBackground(Color.cyan);
    bforget.setBackground(Color.pink);

    blogin.addActionListener(new Login());
    bnewaccount.addActionListener(new Account());
    bforget.addActionListener(new Forget());
  }
Exemple #28
0
 public static void main(String[] args) {
   JFrame frame = new JFrame("redgreen");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setLayout(new FlowLayout());
   SButton red = new SButton("red");
   SButton green = new SButton("green");
   Stream<String> sRed = red.sClicked.map(u -> "red");
   Stream<String> sGreen = green.sClicked.map(u -> "green");
   Stream<String> sColor = sRed.orElse(sGreen);
   Cell<String> color = sColor.hold("");
   SLabel lbl = new SLabel(color);
   frame.add(red);
   frame.add(green);
   frame.add(lbl);
   frame.setSize(400, 160);
   frame.setVisible(true);
 }
  public void init() {
    frame = new JFrame();
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("PersistentFrameTest");
    frame.setSize(400, 200);

    JButton loadButton = new JButton("Load");
    frame.add(loadButton);
    loadButton.addActionListener(EventHandler.create(ActionListener.class, this, "load"));

    JButton saveButton = new JButton("Save");
    frame.add(saveButton);
    saveButton.addActionListener(EventHandler.create(ActionListener.class, this, "save"));

    frame.setVisible(true);
  }
  private void mostrarGUI() {
    janela = new JFrame("Java Swing Examples");
    janela.setSize(400, 400);
    janela.setLayout(new GridLayout(3, 1));

    janela.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent windowEvent) {
            System.exit(0);
          }
        });

    statusLabel = new JLabel("", JLabel.CENTER);
    statusLabel.setSize(350, 100);

    controlPanel = new JPanel();
    controlPanel.setLayout(new FlowLayout());

    ImageIcon icon = criarImageIcon("/resources/home153.png", "Home");

    JButton okButton = new JButton("OK");
    // JButton homeButton = new JButton("Home", icon);

    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            statusLabel.setText("Clicou no Botao Ok.");
          }
        });

    /*
       homeButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
             statusLabel.setText("Clicou no Botao Home.");
          }
       });
    */

    controlPanel.add(okButton);
    // controlPanel.add(homeButton);

    janela.add(statusLabel);
    janela.add(controlPanel);
    janela.setVisible(true);
  }