Exemple #1
0
  public DirTreeModified() {
    Container c = getContentPane();
    // *** Build the tree and a mouse listener to handle clicks
    root = readNode();
    treeModel = new DefaultTreeModel(root);
    tree = new JTree(treeModel);

    MouseListener ml =
        new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (box.isSelected()) {
              showDetails(tree.getPathForLocation(e.getX(), e.getY()));
            }
          }
        };
    tree.addMouseListener(ml);
    // *** panel the JFrame to hold controls and the tree
    controls = new JPanel();
    box = new JCheckBox(showString);
    init(); // ** set colors, fonts, etc. and add buttons
    c.add(controls, BorderLayout.NORTH);
    c.add(tree, BorderLayout.CENTER);
    setVisible(true); // ** display the framed window
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // ** kills process on exit.
  }
 private void createMarginBox(Container c, Component comp) {
   c.add(Box.createVerticalStrut(10));
   Box lrMargins = Box.createHorizontalBox();
   lrMargins.add(Box.createHorizontalStrut(10));
   lrMargins.add(comp);
   lrMargins.add(Box.createHorizontalStrut(10));
   c.add(lrMargins);
   c.add(Box.createVerticalStrut(10));
 }
  public DistributedTextEditor() {
    area1.setFont(new Font("Monospaced", Font.PLAIN, 12));

    area2.setFont(new Font("Monospaced", Font.PLAIN, 12));
    ((AbstractDocument) area1.getDocument()).setDocumentFilter(dec);
    area2.setEditable(false);

    Container content = getContentPane();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    JScrollPane scroll1 =
        new JScrollPane(
            area1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    content.add(scroll1, BorderLayout.CENTER);

    JScrollPane scroll2 =
        new JScrollPane(
            area2, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    content.add(scroll2, BorderLayout.CENTER);

    content.add(ipaddress, BorderLayout.CENTER);
    content.add(portNumber, BorderLayout.CENTER);

    JMenuBar JMB = new JMenuBar();
    setJMenuBar(JMB);
    JMenu file = new JMenu("File");
    JMenu edit = new JMenu("Edit");
    JMB.add(file);
    JMB.add(edit);

    file.add(Listen);
    file.add(Connect);
    file.add(Disconnect);
    file.addSeparator();
    file.add(Save);
    file.add(SaveAs);
    file.add(Quit);

    edit.add(Copy);
    edit.add(Paste);
    edit.getItem(0).setText("Copy");
    edit.getItem(1).setText("Paste");

    Save.setEnabled(false);
    SaveAs.setEnabled(false);
    Disconnect.setEnabled(false);

    setDefaultCloseOperation(EXIT_ON_CLOSE);
    pack();
    area1.addKeyListener(k1);
    area1.addMouseListener(m1);
    setTitle("Disconnected");
    setVisible(true);
    area1.insert("Welcome to Hjortehandlerne's distributed text editor. \n", 0);

    this.addWindowListener(w1);
  }
Exemple #4
0
  /**
   * Cr�e une nouvelle instance de CreeTrans
   *
   * @param mf fenetre principale de l'application
   * @param zg Zone graphique
   * @param auto automate
   * @param be barre d'�tat
   */
  public TransCreator(MainFrame mf, GraphicZone g, Automate auto, StateBar be) {

    super(JOptionPane.getFrameForComponent(mf), "Creating interaction", true);

    this.setResizable(false);

    this.gz = g;
    this.auto = auto;
    this.bar = be;
    this.mf = mf;

    be.displayInfo("Creating interaction");

    tfJPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel1.setBackground(Color.lightGray);
    tfJPanel1.add(new JLabel("Type  : "));
    groupe = new CheckboxGroup();
    plus = new Checkbox("activator", groupe, true);
    tfJPanel1.add(plus);
    minus = new Checkbox("inhibitor", groupe, false);
    tfJPanel1.add(minus);

    tfJPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tfJPanel2.setBackground(Color.lightGray);
    tfJPanel2.add(new JLabel("Threshold  = "));
    tf = new JTextField(auto.nbrCharTransLabel);
    tf.setText("1");
    tfJPanel2.add(tf);

    btJPanel = new JPanel(new GridLayout(1, 2, 0, 0));
    btJPanel.setBackground(Color.lightGray);
    ok = new Button("Ok");
    ok.setBackground(Color.lightGray);
    ok.addActionListener(this);
    cancel = new Button("Cancel");
    cancel.setBackground(Color.lightGray);
    cancel.addActionListener(this);
    btJPanel.add(ok);
    btJPanel.add(cancel);

    content = this.getContentPane();
    content.setLayout(new BorderLayout());
    content.setBackground(Color.lightGray);
    content.add(tfJPanel1, BorderLayout.NORTH);
    content.add(tfJPanel2, BorderLayout.CENTER);
    content.add(btJPanel, BorderLayout.SOUTH);

    this.pack();
    this.setLocationRelativeTo(this.mf);

    tf.requestFocusInWindow();

    // rendre la fenetre visible
    setVisible(true);
  }
  // Create an editor.
  public SimpleEditor() {
    super("Swing Editor");
    textComp = createTextComponent();
    makeActionsPretty();

    Container content = getContentPane();
    content.add(textComp, BorderLayout.CENTER);
    content.add(createToolBar(), BorderLayout.NORTH);
    setJMenuBar(createMenuBar());
    setSize(320, 240);
  }
Exemple #6
0
  public void paint(Graphics g) {
    super.paint(g);
    if (screen.equalsIgnoreCase("title")) {
      MyPanel.score = 0;
      hs = new Highscore();
      c.removeAll();
      c.add(ts);
      panel = null;
      ts.revalidate();
    } else if (screen.equalsIgnoreCase("instructions")) {
      c.removeAll();
      c.add(instructions);
      instructions.revalidate();
    } else if (screen.equalsIgnoreCase("mode")) {
      c.removeAll();
      c.add(mode);
      mode.revalidate();
    } else if (screen.equalsIgnoreCase("difficulty")) {
      c.removeAll();
      c.add(dif);
      dif.revalidate();
    } else if (screen.equalsIgnoreCase("highscore")) {
      if (hs.returnCount() == 0) {
        c.removeAll();
        c.add(hs);
        c.validate();
      }
    } else if (screen.equalsIgnoreCase("gameover")) {
      if (!once) {
        c.removeAll();
        c.add(gg);
        once = true;
        c.validate();
      }

    } else {
      if (once) {
        c.removeAll();
        panel = new MyPanel(THA.WIDTH, THA.HEIGHT, ai, diff);
        c.setLayout(new BorderLayout());
        c.add(panel.returnNs(), BorderLayout.WEST);
        c.add(panel, BorderLayout.CENTER);
        c.add(btns, BorderLayout.SOUTH);
        c.add(panel.returnAmmo(), BorderLayout.EAST);
        c.validate();
        once = false;
      }
    }
    repaint();
  }
Exemple #7
0
 private void initPanels() {
   Container contentPane = getContentPane();
   humanArea = new PlayerView("Me");
   computerArea = new PlayerView("Computer");
   myBoardPanel4 = new BoggleBoardPanel(4, 4);
   myBoardPanel5 = new BoggleBoardPanel(5, 5);
   myBoardPanel = myBoardPanel5;
   wordEntryField = new WordEntryField();
   contentPane.add(wordEntryField, BorderLayout.SOUTH);
   contentPane.add(humanArea, BorderLayout.WEST);
   contentPane.add(myBoardPanel, BorderLayout.CENTER);
   contentPane.add(computerArea, BorderLayout.EAST);
   contentPane.add(makeProgressBar(), BorderLayout.NORTH);
 }
    // 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.
    public String[] promptKeyboardInteractive(
        String destination, String name, String instruction, String[] prompt, boolean[] echo) {
      panel = new JPanel();
      panel.setLayout(new GridBagLayout());

      gbc.weightx = 1.0;
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      gbc.gridx = 0;
      panel.add(new JLabel(instruction), gbc);
      gbc.gridy++;

      gbc.gridwidth = GridBagConstraints.RELATIVE;

      JTextField[] texts = new JTextField[prompt.length];
      for (int i = 0; i < prompt.length; i++) {
        gbc.fill = GridBagConstraints.NONE;
        gbc.gridx = 0;
        gbc.weightx = 1;
        panel.add(new JLabel(prompt[i]), gbc);

        gbc.gridx = 1;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        gbc.weighty = 1;
        if (echo[i]) {
          texts[i] = new JTextField(20);
        } else {
          texts[i] = new JPasswordField(20);
        }
        panel.add(texts[i], gbc);
        gbc.gridy++;
      }

      if (JOptionPane.showConfirmDialog(
              null,
              panel,
              destination + ": " + name,
              JOptionPane.OK_CANCEL_OPTION,
              JOptionPane.QUESTION_MESSAGE)
          == JOptionPane.OK_OPTION) {
        String[] response = new String[prompt.length];
        for (int i = 0; i < prompt.length; i++) {
          response[i] = texts[i].getText();
        }
        return response;
      } else {
        return null; // cancel
      }
    }
  public void setUpGUI(Container container) {
    // <Begin_setUpGUI_Container>
    container.add(Top, BorderLayout.CENTER);
    Top.setLayout(new BorderLayout(5, 5));
    Top.add(JPanel1, BorderLayout.CENTER);
    JPanel1.setLayout(new BorderLayout(5, 5));
    JPanel1.add(JScrollPane1, BorderLayout.CENTER);
    JScrollPane1.getViewport().add(JTable1);
    JPanel1.add(JPanel6, BorderLayout.WEST);
    JPanel6.setLayout(new BorderLayout(5, 5));
    JPanel6.add(JLabel2, BorderLayout.CENTER);
    Top.add(JPanel2, BorderLayout.SOUTH);
    JPanel2.setLayout(new GridLayout(1, 1, 5, 5));
    JPanel2.add(JPanel3);
    JPanel3.setLayout(new FlowLayout(2, 5, 5));
    JPanel3.add(JButton1);
    JPanel3.add(JButton2);
    JPanel3.add(JButton3);
    JPanel3.add(closeButton);
    Top.add(JPanel5, BorderLayout.NORTH);
    JPanel5.setLayout(new GridLayout(2, 1, 5, 5));
    JPanel5.add(JLabel1);

    // <End_setUpGUI_Container>
  }
Exemple #11
0
  public MsnTreeTest() {
    String[] tab = {"hello", "test", "blabla"};

    container = getContentPane();
    container.setLayout(null);

    eleve = new DefaultMutableTreeNode("MSN");

    worker = new DefaultMutableTreeNode("Worker");
    prof = new DefaultMutableTreeNode("Profs");

    for (int i = 0; i < tab.length; i++) {
      worker.add(new DefaultMutableTreeNode(tab[i]));
      prof.add(new DefaultMutableTreeNode(tab[i]));
    }
    //        worker.add(new DefaultMutableTreeNode("hello world2"));

    eleve.add(worker);
    eleve.add(prof);

    tree = new JTree(eleve);

    scroll = new JScrollPane(tree);
    scroll.setBounds(10, 10, 100, 100);

    container.add(scroll);

    setSize(300, 300);
    setLocation(200, 200);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setVisible(true);

    //        worker.add(n);

  }
  public void addClient() {
    client =
        new Canvas() {
          public void paint(Graphics g) {
            super.paint(g);
          }
        };
    client.setBackground(new Color(30, 220, 40));
    clientCont.add(client);
    clientCont.validate();
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    WindowIDProvider pid = (WindowIDProvider) acc.getPeer(client);
    log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow());
    Rectangle toFocusBounds = toFocus.getBounds();
    toFocusBounds.setLocation(toFocus.getLocationOnScreen());
    f.validate();

    // KDE doesn't accept clicks on title as activation - click below title
    Rectangle fbounds = f.getBounds();
    fbounds.y += f.getInsets().top;
    fbounds.height -= f.getInsets().top;

    Process proc =
        startClient(
            new Rectangle[] {
              fbounds,
              dummy.getBounds(),
              toFocusBounds,
              new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()),
              new Rectangle(10, 130, 20, 20)
            },
            pid.getWindow());
    new ClientWatcher(client, proc, clientCont).start();
  }
Exemple #13
0
  public About() {
    cl = ClassLoader.getSystemClassLoader();

    // ----------------------------------------CENTER--------------------------------//
    imgAbout = new ImageIcon(cl.getResource("om.png"));

    lblAbout = new JLabel(imgAbout);

    lblAbout.setBounds(0, 0, 450, 263);

    JPanel pnlCenter = new JPanel();
    pnlCenter.setLayout(null);
    pnlCenter.add(lblAbout);

    btnOk = new JButton(new ImageIcon(cl.getResource("ok.png")));
    btnOk.setBounds(390, 215, 40, 30);
    pnlCenter.add(btnOk);
    btnOk.addActionListener(this);

    // -----------------------------------CONTAINER----------------------------------//
    Container c = getContentPane();
    c.setLayout(new BorderLayout());
    c.add(pnlCenter, BorderLayout.CENTER);
    setSize(450, 280);
    setVisible(true);
    setResizable(false);
    setLocation(580, 280);
    // setDefaultCloseOperation(EXIT_ON_CLOSE);

  }
Exemple #14
0
    public void actionPerformed(ActionEvent e) {
      if (elementTreeFrame == null) {
        // Create a frame containing an instance of
        // ElementTreePanel.
        try {
          String title = resources.getString("ElementTreeFrameTitle");
          elementTreeFrame = new JFrame(title);
        } catch (MissingResourceException mre) {
          elementTreeFrame = new JFrame();
        }

        elementTreeFrame.addWindowListener(
            new WindowAdapter() {

              @Override
              public void windowClosing(WindowEvent weeee) {
                elementTreeFrame.setVisible(false);
              }
            });
        Container fContentPane = elementTreeFrame.getContentPane();

        fContentPane.setLayout(new BorderLayout());
        elementTreePanel = new ElementTreePanel(getEditor());
        fContentPane.add(elementTreePanel);
        elementTreeFrame.pack();
      }
      elementTreeFrame.setVisible(true);
    }
Exemple #15
0
  // Add a test case to testBox and tests array.
  private void addTest() {

    // Set up the frame for the file chooser.
    final JFrame appframe = new JFrame("Select Application");
    appframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    Container contentPane = appframe.getContentPane();
    JFileChooser fileChooser = new JFileChooser(".");

    // Only let you select directories and add chooser to pane.
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    contentPane.add(fileChooser, BorderLayout.CENTER);

    // Make a new action listener for the file chooser.
    ActionListener actionListener =
        new ActionListener() {

          public void actionPerformed(ActionEvent actionEvent) {

            // Get the information to check if the file chosen is valid.
            JFileChooser theFileChooser = (JFileChooser) actionEvent.getSource();
            String command = actionEvent.getActionCommand();

            // If the user cancels selecting a program.
            if (command.equals(JFileChooser.CANCEL_SELECTION)) {
              appframe.setVisible(false);
              appframe.dispose();
              return;
            }

            // If the file chosen is valid.
            if (command.equals(JFileChooser.APPROVE_SELECTION)) {
              // Retrieve the selected file and ask for the main class name.
              File f = theFileChooser.getSelectedFile();

              // Obtain the file URL.
              String fileURL = null;
              fileURL = f.getAbsolutePath();

              // Add a checkbox to the testing check pane.
              JCheckBox newTest = new JCheckBox(fileURL, true);
              testBox.setEditable(true);
              testBox.add(newTest);
              testBox.repaint();
              testBox.setEditable(false);
              // Add the test to the list of tests.
              tests.add(newTest);

              // Make the file chooser disappear.
              appframe.setVisible(false);
              appframe.dispose();
            }
          }
        };

    // Add the action listener created above to file chooser, display it.
    fileChooser.addActionListener(actionListener);
    appframe.pack();
    appframe.setVisible(true);
  }
  public void setPanel(Parameters pp, String s) {
    JPanel buttonsPanel = new JPanel();
    okButton = new JButton("确定");
    okButton.addActionListener(this);

    dialog = new JDialog(this, s + " 参数选择", true);

    Container contentPane = getContentPane();
    Container dialogContentPane = dialog.getContentPane();

    dialogContentPane.add(pp, BorderLayout.CENTER);
    dialogContentPane.add(buttonsPanel, BorderLayout.SOUTH);
    dialog.pack();
    buttonsPanel.add(okButton);
    dialog.setLocation(50, 330);
    dialog.show();
  }
  /**
   * Creates an instance of <tt>SelectScreenDialog</tt> by specifying the list of possible desktop
   * devices to choose from.
   *
   * @param desktopDevices the list of possible desktop devices to choose from
   */
  public SelectScreenDialog(List<MediaDevice> desktopDevices) {
    setModal(true);

    setPreferredSize(new Dimension(400, 300));

    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    deviceComboBox = new JComboBox(desktopDevices.toArray());
    contentPane.add(deviceComboBox, BorderLayout.NORTH);

    deviceComboBox.setRenderer(new ComboRenderer());

    contentPane.add(createPreview(deviceComboBox));

    contentPane.add(createButtonsPanel(), BorderLayout.SOUTH);
  }
Exemple #18
0
  // Constructor
  public FileWindow() {

    myWindow = new JFrame("New File");
    myWindow.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    Container contentPane = myWindow.getContentPane();
    contentPane.setLayout(new BorderLayout());

    saveButton = new JButton("Save File");
    saveButton.setSelected(false);
    saveButton.setActionCommand("save");
    saveButton.setMnemonic('S');
    // saveButton.addActionListener(new ScriptWindowButtonListener());

    clearButton = new JButton("Clear Contents");
    clearButton.setSelected(false);
    clearButton.setActionCommand("clear");
    clearButton.setMnemonic('B');
    clearButton.addActionListener(new ScriptWindowButtonListener());

    cancelButton = new JButton("Quit");
    cancelButton.setSelected(false);
    cancelButton.setActionCommand("quit");
    cancelButton.setMnemonic('Q');
    cancelButton.addActionListener(new ScriptWindowButtonListener());

    //		loadButton = new JButton("Load Script");
    //		loadButton.setSelected(false);
    //		loadButton.setActionCommand("load");
    //		loadButton.setMnemonic('L');
    //		loadButton.addActionListener(new ScriptWindowButtonListener());
    //
    //		runButton = new JButton("Run Script");
    //		runButton.setSelected(false);
    //		runButton.setActionCommand("run");
    //		runButton.setMnemonic('L');
    //		runButton.addActionListener(new ScriptWindowButtonListener());

    buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(1, 0));
    // buttonPanel.add(runButton);
    buttonPanel.add(saveButton);
    // buttonPanel.add(loadButton);
    buttonPanel.add(clearButton);
    // buttonPanel.add(cancelButton);

    fileChooser = new JFileChooser();

    scriptArea = new JTextArea(35, 30);
    JScrollPane scroller = new JScrollPane(scriptArea);

    textHolder = new JPanel();
    textHolder.setLayout(new BorderLayout());
    textHolder.add(scroller, BorderLayout.CENTER);

    contentPane.add(buttonPanel, BorderLayout.NORTH);
    contentPane.add(textHolder, BorderLayout.CENTER);
    myWindow.pack();
  }
  public Welcome() {
    c.setLayout(null);

    c.add(welcome);
    welcome.setBounds(250, 100, 600, 50);
    welcome.setFont(font1);
    welcome.setForeground(Color.black);

    c.add(hotel);
    hotel.setBounds(350, 170, 700, 50);
    hotel.setFont(font2);
    hotel.setForeground(Color.black);

    c.add(check);
    check.setBounds(450, 350, 250, 50);
    check.addActionListener(this);

    c.add(order);
    order.setBounds(150, 350, 250, 50);
    order.addActionListener(this);

    c.add(bill);
    bill.setBounds(750, 350, 250, 50);
    bill.addActionListener(this);

    c.add(exit);
    exit.setBounds(40, 600, 130, 20);
    exit.addActionListener(this);

    c.add(back).setBounds(0, 0, 1800, 1000);
  }
Exemple #20
0
 public static void main(String[] argv) throws NoSuchMethodException {
   f = new JFrame();
   Container c = f.getContentPane();
   c.setLayout(new BorderLayout());
   c.add(new WordListScreen(null), BorderLayout.CENTER);
   f.pack();
   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   showFrame(true);
 }
 public objUpdate() {
   super("Person");
   setBounds(150, 150, 200, 120);
   setResizable(false);
   setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
   Container con = this.getContentPane();
   con.setLayout(new FlowLayout());
   con.add(n);
   con.add(d);
   next.setMnemonic('N');
   newPerson.setMnemonic('P');
   con.add(next);
   con.add(newPerson);
   this.addWindowListener(new Window());
   next.addActionListener(new Next());
   newPerson.addActionListener(new NewPerson());
   setVisible(true);
 }
 public BSInterface() {
   mainFrame.setSize(960, 720);
   mainFrame.setResizable(false);
   mainFrame.setIconImage(Toolkit.getDefaultToolkit().createImage("pic/ticket_16.png"));
   Container contentPane = mainFrame.getContentPane();
   contentPane.setLayout(new BorderLayout());
   contentPane.add(toolPanel, BorderLayout.NORTH);
   contentPane.add(operPanel, BorderLayout.CENTER);
   mainFrame.setContentPane(contentPane);
   mainFrame.setVisible(true);
   mainFrame.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent we) {
           // device_close();
           System.exit(0);
         }
       });
 }
  public SelectableTree() {
    super("JTree Selections");
    WindowUtilities.setNativeLookAndFeel();
    addWindowListener(new ExitListener());
    Container content = getContentPane();

    String[] namesplitStrings = mainDir.toString().split("\\\\");
    String filename = namesplitStrings[namesplitStrings.length - 1];
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(filename);

    addChildren(root, mainDir);
    tree = new JTree(root);
    tree.addTreeSelectionListener(this);
    content.add(new JScrollPane(tree), BorderLayout.CENTER);
    currentSelectionField = new JTextField("Current Selection: NONE");
    content.add(currentSelectionField, BorderLayout.SOUTH);
    setSize(250, 275);
    setVisible(true);
  }
  public GeneralGUI(Whois whois) {

    super("Internic Whois");
    this.server = whois;
    Container pane = this.getContentPane();

    // whois.internic.net assumes a monospaced font, 72 columns across
    Font f = new Font("Monospaced", Font.PLAIN, 12);
    names.setFont(f);
    names.setEditable(false);

    JPanel CenterPanel = new JPanel();
    CenterPanel.setLayout(new GridLayout(1, 1, 10, 10));
    JScrollPane jsp = new JScrollPane(names);
    CenterPanel.add(jsp);
    pane.add("Center", CenterPanel);

    // You don't want the buttons in the south and north
    // to fill the entire sections so add Panels there
    // and use FlowLayouts in the Panel
    JPanel NorthPanel = new JPanel();
    JPanel NorthPanelTop = new JPanel();
    NorthPanelTop.setLayout(new FlowLayout(FlowLayout.LEFT));
    NorthPanelTop.add(new JLabel("Whois: "));
    NorthPanelTop.add("North", searchString);
    NorthPanelTop.add(exactMatch);
    NorthPanelTop.add(findButton);
    NorthPanel.setLayout(new BorderLayout(2, 1));
    NorthPanel.add("North", NorthPanelTop);
    JPanel NorthPanelBottom = new JPanel();
    NorthPanelBottom.setLayout(new GridLayout(1, 3, 5, 5));
    NorthPanelBottom.add(initRecordType());
    NorthPanelBottom.add(initSearchFields());
    NorthPanelBottom.add(initServerChoice());
    NorthPanel.add("Center", NorthPanelBottom);
    JPanel SouthPanel = new JPanel();

    pane.add("North", NorthPanel);

    ActionListener al = new LookupNames();
    findButton.addActionListener(al);
    searchString.addActionListener(al);
  }
  private void init(EditorPatternButton imgBtn, boolean exact, float similarity, int numMatches) {
    setTitle(_I("winPatternSettings"));
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    _imgBtn = imgBtn;
    Point pos = imgBtn.getLocationOnScreen();
    Debug.log(4, "pattern window: " + pos);
    setLocation(pos.x + imgBtn.getWidth(), pos.y);

    takeScreenshot();
    Container c = getContentPane();
    c.setLayout(new BorderLayout());

    tabPane = new JTabbedPane();
    tabPane.setPreferredSize(new Dimension(790, 700));
    msgApplied = new JLabel[tabMax];

    msgApplied[tabSequence] = new JLabel("...");
    paneNaming = new PatternPaneNaming(_imgBtn, msgApplied[tabSequence++]);
    tabPane.addTab(_I("tabNaming"), paneNaming);

    msgApplied[tabSequence] = new JLabel("...");
    panePreview = createPreviewPanel();
    tabSequence++;
    tabPane.addTab(_I("tabMatchingPreview"), panePreview);

    msgApplied[tabSequence] = new JLabel("...");
    paneTarget = createTargetPanel();
    tabSequence++;
    tabPane.addTab(_I("tabTargetOffset"), paneTarget);

    c.add(tabPane, BorderLayout.CENTER);
    c.add(createButtons(), BorderLayout.SOUTH);
    c.doLayout();
    pack();
    try {
      _screenshot.setParameters(_imgBtn.getFilename(), exact, similarity, numMatches);
    } catch (Exception e) {
      Debug.error(me + "Problem while setting up pattern pane\n%s", e.getMessage());
    }
    setDirty(false);
    setVisible(true);
  }
Exemple #26
0
 public void propertyChange(PropertyChangeEvent evt) {
   if (DisplayOptions.isUpdateUIEvent(evt)) {
     SwingUtilities.updateComponentTreeUI(this);
     gradientPanel.remove(drawable);
     JPanel newpanel = createGradientPanel();
     contentPane.remove(gradientPanel);
     gradientPanel = newpanel;
     gradientPanel.add(drawable, BorderLayout.CENTER);
     contentPane.add(gradientPanel, BorderLayout.CENTER);
   }
 }
 public RegistracijosForma() {
   Container vidus = getContentPane();
   vidus.setLayout(new BoxLayout(vidus, BoxLayout.Y_AXIS));
   vidus.add(panAutoSąr);
   vidus.add(panDuomenys);
   jbReg.addActionListener(this);
   jbRasti.addActionListener(this);
   jbSkaityti.addActionListener(this);
   jbSaveObj.addActionListener(this);
   jbLoadObj.addActionListener(this);
   setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   //        setSize(400,600);
   išdėstymas();
   kosmetika();
   setVisible(true);
   // deserializuojame rg objektą su visomis struktūromis
   rg = (RegistracijaAuto) loadObject("temp.obj");
   if (rg == null) rg = new RegistracijaAuto();
   rodytiAutoRinkinius();
   pack();
 }
 private void showIDE(boolean show) {
   SikuliIDE.getInstance().setVisible(show);
   if (show) {
     addMinComponentsToPane(mainPane);
   } else {
     addMinComponentsToPane(minPane);
     Container con = minFrame.getContentPane();
     con.add(minPane);
     minFrame.doLayout();
   }
   minFrame.setVisible(!show);
 }
 /**
  * Adds a radio button to select an algorithm.
  *
  * @param c the container into which to place the button
  * @param name the algorithm name
  * @param g the button group
  */
 public void addRadioButton(Container c, final String name, ButtonGroup g) {
   ActionListener listener =
       new ActionListener() {
         public void actionPerformed(ActionEvent event) {
           setAlgorithm(name);
         }
       };
   JRadioButton b = new JRadioButton(name, g.getButtonCount() == 0);
   c.add(b);
   g.add(b);
   b.addActionListener(listener);
 }
  private void drawComponents() {
    GridBagConstraints con = new GridBagConstraints();
    con.gridx = 0;
    con.gridy = 0;
    con.gridwidth = 1;
    con.gridheight = 1;
    con.anchor = GridBagConstraints.NORTH;
    con.fill = GridBagConstraints.HORIZONTAL;
    con.insets = new Insets(5, 5, 5, 5);
    con.weightx = 0;
    con.weighty = 0;

    Box btns = Box.createHorizontalBox();
    btns.add(btnDetails);
    btns.add(Box.createHorizontalGlue());
    btns.add(btnClose);

    // Set up content
    Container content = getContentPane();
    content.setLayout(new GridBagLayout());

    // Add message label
    con.weightx = 1;
    con.weighty = 1;
    content.add(lblMessage, con);

    // Add button box
    con.gridy = 1;
    con.weighty = 0;
    content.add(btns, con);

    // Add trace pane
    con.gridy = 2;

    content.add(srlTrace, con);

    // Set default button
    getRootPane().setDefaultButton(btnClose);
  }