Exemplo n.º 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);
          }
        });
  }
Exemplo n.º 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();
 }
Exemplo n.º 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 f = new WindowEvent_2();
   f.setSize(300, 100);
   f.setTitle("WindowAdapter_2");
   f.setVisible(true);
 }