Beispiel #1
0
    @Override
    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      JFileChooser chooser = new JFileChooser();
      int ret = chooser.showOpenDialog(frame);

      if (ret != JFileChooser.APPROVE_OPTION) {
        return;
      }

      File f = chooser.getSelectedFile();
      if (f.isFile() && f.canRead()) {
        Document oldDoc = getEditor().getDocument();
        if (oldDoc != null) {
          oldDoc.removeUndoableEditListener(undoHandler);
        }
        if (elementTreePanel != null) {
          elementTreePanel.setEditor(null);
        }
        getEditor().setDocument(new PlainDocument());
        frame.setTitle(f.getName());
        Thread loader = new FileLoader(f, editor.getDocument());
        loader.start();
      } else {
        JOptionPane.showMessageDialog(
            getFrame(),
            "Could not open file: " + f,
            "Error opening file",
            JOptionPane.ERROR_MESSAGE);
      }
    }
  // Color gre;
  Rules(String se) {
    email = se;
    conti = new Button("Continue");
    rules = new Button("ClicK Here For Rules");
    p1 = new JOptionPane();
    Icon image = new ImageIcon("books.jpg");
    Icon image1 = new ImageIcon("girl.jpg");
    Icon image2 = new ImageIcon("uit.jpg");
    gl = new GridBagLayout();
    gbc = new GridBagConstraints();
    conti.addActionListener(this);
    rules.addActionListener(this);
    // gre=new Color(117,102,185);
    p = new Panel();
    p2 = new Panel();
    p3 = new Panel();
    p4 = new Panel();
    f = new Frame();
    pic = new JLabel(image);
    pic1 = new JLabel(image1);
    pic2 = new JLabel(image2);
    gbc.anchor = GridBagConstraints.SOUTHWEST;
    gl.setConstraints(pic1, gbc);
    gbc.anchor = GridBagConstraints.SOUTHEAST;
    gl.setConstraints(pic, gbc);
    Insets is = new Insets(30, 30, 30, 30);
    gbc.insets = is;
    gbc.ipadx = 14;
    gbc.ipady = 8;
    gl.setConstraints(rules, gbc);
    gl.setConstraints(conti, gbc);
    p2.setLayout(gl);
    p4.add(pic2);
    p2.add(pic);
    p3.setLayout(gl);
    p3.add(pic1);
    p.add(conti);
    p.add(rules);
    p.setLayout(gl);
    f.add(p4, "North");
    f.add(p3, "East");
    f.add(p2, "West");

    f.add(p, "Center");
    f.setTitle("RULES BOOK");
    // f.setBackground(gre);
    f.setVisible(true);
    f.setSize(900, 600);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent we) {
            System.exit(0);
          }
        });
  }
Beispiel #3
0
 /**
  * Main entry point for the application
  *
  * @param args List of command line arguments passed to the app
  */
 public static void main(String args[]) {
   // create the main application window
   Frame appWindow = new $safeitemname$();
   // set the window properties
   appWindow.setTitle("$itemname$");
   appWindow.setSize(600, 400);
   appWindow.setBackground(new Color(215, 215, 215));
   appWindow.validate();
   // show the window
   appWindow.show();
 }
Beispiel #4
0
    public void actionPerformed(ActionEvent e) {
      Frame frame = getFrame();
      JFileChooser chooser = new JFileChooser();
      int ret = chooser.showSaveDialog(frame);

      if (ret != JFileChooser.APPROVE_OPTION) {
        return;
      }

      File f = chooser.getSelectedFile();
      frame.setTitle(f.getName());
      Thread saver = new FileSaver(f, editor.getDocument());
      saver.start();
    }
  public static void main(String[] args) {
    Frame MiMarco = new Frame();
    Panel MiPanel = new Panel();
    GridLayout Matriz = new GridLayout(2, 3);

    Button[] Botones = new Button[6];
    for (int i = 0; i < 6; i++) Botones[i] = new Button("Botón " + i);

    MiPanel.setLayout(Matriz);
    for (int i = 0; i < 6; i++) MiPanel.add(Botones[i]);

    MiMarco.add(MiPanel);
    MiMarco.setSize(300, 100);
    MiMarco.setTitle("Ventana con GridLayout");
    MiMarco.setVisible(true);
  }
Beispiel #6
0
  public void createGUI() {

    frame = new Frame();
    frame.setTitle("KeyMaskTest");
    frame.setLayout(new GridLayout(1, 6));

    button = new Button();
    button.addKeyListener(this);
    frame.add(button);

    buttonLW = new LWButton();
    buttonLW.addKeyListener(this);
    frame.add(buttonLW);

    textField = new TextField(5);
    textField.addKeyListener(this);
    frame.add(textField);

    textArea = new TextArea(5, 5);
    textArea.addKeyListener(this);
    frame.add(textArea);

    list = new List();
    for (int i = 1; i <= 5; ++i) {
      list.add("item " + i);
    }
    list.addKeyListener(this);
    frame.add(list);

    listLW = new LWList();
    for (int i = 1; i <= 5; ++i) {
      listLW.add("item " + i);
    }
    listLW.addKeyListener(this);
    frame.add(listLW);

    frame.setBackground(Color.gray);
    frame.setSize(500, 100);
    frame.setVisible(true);
    frame.toFront();
  }
Beispiel #7
0
 /** {@inheritDoc} */
 @Override
 public void update(final Frame c, final String key, final Value value, final Object... data) {
   c.setTitle(getDefaultText(value, data));
 }
 public static void main(String[] args) {
   Frame f = new WindowEvent_2();
   f.setSize(300, 100);
   f.setTitle("WindowAdapter_2");
   f.setVisible(true);
 }