// server constructor that receive the port to listen to for connection as parameter
  ServerGUI(int port) {
    super("Server Chat");
    server = null;
    // in the NorthPanel the PortNumber the Start and Stop buttons
    JPanel north = new JPanel();
    north.add(new JLabel("Nomor Port: "));
    tPortNumber = new JTextField("           " + port);
    north.add(tPortNumber);
    // to stop or start the server, we start with "Start"
    stopStart = new JButton("Start");
    stopStart.addActionListener(this);
    north.add(stopStart);
    add(north, BorderLayout.NORTH);

    // the event and chat room
    JPanel center = new JPanel(new GridLayout(2, 1));
    chat = new JTextArea(80, 80);
    chat.setEditable(false);
    appendRoom("Chat Room.\n");
    center.add(new JScrollPane(chat));
    event = new JTextArea(80, 80);
    event.setEditable(false);
    appendEvent("Events log.\n");
    center.add(new JScrollPane(event));
    add(center);

    // need to be informed when the user click the close button on the frame
    addWindowListener(this);
    setSize(500, 600);
    setVisible(true);
  }
Example #2
0
  ServerGUI(int port) {
    super("Chat Server");
    server = null;
    JPanel north = new JPanel();
    north.add(new JLabel("Port Number"));
    tPortNumber = new JTextField(" " + port);
    north.add(tPortNumber);

    stopStart = new JButton("Start");
    stopStart.addActionListener(this);
    north.add(stopStart);
    add(north, BorderLayout.NORTH);

    JPanel center = new JPanel(new GridLayout(2, 1));
    chat = new JTextArea(80, 80);
    chat.setEditable(false);
    appendRoom("Chat Room.\n");
    center.add(new JScrollPane(chat));
    event = new JTextArea(80, 80);
    event.setEditable(false);
    appendEvent("Events log.\n");
    center.add(new JScrollPane(event));
    add(center);

    addWindowListener(this);
    setSize(400, 600);
    setVisible(true);
  }
Example #3
0
    public void mousePressed(MouseEvent e) {
      if (e.getButton() == e.BUTTON3) {
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(2);
        int index = list.locationToIndex(e.getPoint());
        GetImageFile gif = new GetImageFile(files[index]);

        JTextArea area =
            new JTextArea(
                "File: "
                    + gif.getImageString()
                    + "\n"
                    + "Score: "
                    + nf.format(scores[index])
                    + "\n"
                    + "Pairs: "
                    + nrpairs[index]);
        area.setEditable(false);
        area.setBorder(BorderFactory.createLineBorder(Color.black));
        area.setFont(new Font("times", Font.PLAIN, 12));
        PopupFactory factory = PopupFactory.getSharedInstance();
        popup =
            factory.getPopup(
                null,
                area,
                (int) e.getComponent().getLocationOnScreen().getX() + e.getX() + 25,
                (int) e.getComponent().getLocationOnScreen().getY() + e.getY());
        popup.show();
      }
    }
  private void initComponent() {
    // Create the logger first, because the action listeners
    // need to refer to it.
    logger = new JTextArea(8, 50);
    logger.setMargin(new Insets(5, 5, 5, 5));
    logger.setEditable(false);

    JScrollPane logScrollPane = new JScrollPane(logger);

    // Create a file chooser
    fc = new JFileChooser();
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    // Create the open button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    openButton = new JButton("Chose NetBeans ...", createImageIcon("images/open.gif"));
    openButton.addActionListener(GuiFriendlizerApp.this);

    // Create the save button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    patchButton = new JButton("Do Patch", createImageIcon("images/patch.gif"));
    patchButton.addActionListener(GuiFriendlizerApp.this);
    patchButton.setEnabled(false);

    // For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel(); // use FlowLayout
    buttonPanel.add(openButton);
    buttonPanel.add(patchButton);

    // Add the buttons and the logger to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(logScrollPane, BorderLayout.CENTER);
  }
Example #5
0
  public Cliente(Socket s) {
    super("OPERACIONES CON BD");
    socket = s;
    try {
      salida = new DataOutputStream(socket.getOutputStream());
      inObjeto = new ObjectInputStream(socket.getInputStream());
    } catch (IOException e) {
      e.printStackTrace();
      System.exit(0);
    }
    setLayout(null);
    etiqueta.setBounds(10, 10, 200, 30);
    add(etiqueta);
    empconsultar.setBounds(210, 10, 50, 30);
    add(empconsultar);

    textarea1 = new JTextArea();
    scrollpane1 = new JScrollPane(textarea1);
    scrollpane1.setBounds(10, 50, 400, 300);
    add(scrollpane1);
    boton.setBounds(420, 10, 100, 30);
    add(boton);
    desconectar.setBounds(420, 50, 100, 30);
    add(desconectar);

    textarea1.setEditable(false);
    boton.addActionListener(this);
    desconectar.addActionListener(this);
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  }
Example #6
0
  // Initialize all the GUI components and display the frame
  private static void initGUI() {
    // Set up the status bar
    statusField = new JLabel();
    statusField.setText(statusMessages[DISCONNECTED]);
    statusColor = new JTextField(1);
    statusColor.setBackground(Color.red);
    statusColor.setEditable(false);
    statusBar = new JPanel(new BorderLayout());
    statusBar.add(statusColor, BorderLayout.WEST);
    statusBar.add(statusField, BorderLayout.CENTER);

    // Set up the options pane
    JPanel optionsPane = initOptionsPane();

    // Set up the chat pane
    JPanel chatPane = new JPanel(new BorderLayout());
    chatText = new JTextArea(10, 20);
    chatText.setLineWrap(true);
    chatText.setEditable(false);
    chatText.setForeground(Color.blue);
    JScrollPane chatTextPane =
        new JScrollPane(
            chatText,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    chatLine = new JTextField();
    chatLine.setEnabled(false);
    chatLine.addActionListener(
        new ActionAdapter() {
          public void actionPerformed(ActionEvent e) {
            String s = chatLine.getText();
            if (!s.equals("")) {
              appendToChatBox("OUTGOING: " + s + "\n");
              chatLine.selectAll();

              // Send the string
              sendString(s);
            }
          }
        });
    chatPane.add(chatLine, BorderLayout.SOUTH);
    chatPane.add(chatTextPane, BorderLayout.CENTER);
    chatPane.setPreferredSize(new Dimension(200, 200));

    // Set up the main pane
    JPanel mainPane = new JPanel(new BorderLayout());
    mainPane.add(statusBar, BorderLayout.SOUTH);
    mainPane.add(optionsPane, BorderLayout.WEST);
    mainPane.add(chatPane, BorderLayout.CENTER);

    // Set up the main frame
    mainFrame = new JFrame("Simple TCP Chat");
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    mainFrame.setContentPane(mainPane);
    mainFrame.setSize(mainFrame.getPreferredSize());
    mainFrame.setLocation(200, 200);
    mainFrame.pack();
    mainFrame.setVisible(true);
  }
Example #7
0
 /**
  * Set the value of taskbar
  *
  * @param newVar the new value of taskbar
  */
 private void setTaskbar() {
   /** *****************Task Bar**************** */
   taskbar = new JTextArea();
   taskbar.setVisible(true);
   taskbar.setBackground(Color.lightGray);
   taskbar.setEditable(false);
   /** *****************End of Task Bar**************** */
 }
  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);
  }
Example #9
0
  public LicenseDialog(Component parent) {
    setTitle("Licensing information");

    pnlButtons.add(bttnOk);

    cbLang.addItem("English");
    cbLang.addItem("Eesti");

    FlowLayout fl = new FlowLayout();
    fl.setAlignment(FlowLayout.LEFT);

    pnlHeader.setLayout(fl);

    pnlHeader.add(lblLang);
    pnlHeader.add(cbLang);

    pnlMain.setLayout(new BorderLayout());
    pnlMain.add(pnlHeader, BorderLayout.NORTH);
    pnlMain.add(scrollPane, BorderLayout.CENTER);
    pnlMain.add(pnlButtons, BorderLayout.SOUTH);

    taLicenseText.setText(getLicenseText());
    taLicenseText.setCaretPosition(0);
    taLicenseText.setLineWrap(true);
    taLicenseText.setEditable(false);
    taLicenseText.setWrapStyleWord(true);

    getContentPane().add(pnlMain);
    setPreferredSize(new Dimension(500, 600));
    setLocationRelativeTo(parent);

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    bttnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            if (evt.getSource() == bttnOk) {
              dispose();
            }
          } // end actionPerformed
        }); // end bttnOk Action Listener

    cbLang.addItemListener(
        new ItemListener() {
          public void itemStateChanged(final ItemEvent event) {
            if (event.getSource() == cbLang
                && event.getStateChange() == ItemEvent.SELECTED
                && cbLang.getItemCount() > 0) {
              taLicenseText.setText(getLicenseText());
              taLicenseText.setCaretPosition(0);
            }
          }
        }); // end cbLang item listener

    pack();
    setVisible(true);
  } // PortPropertiesDialog
Example #10
0
 public void setOutputPanel() {
   BoxLayout box = new BoxLayout(output, BoxLayout.Y_AXIS);
   output.setLayout(box);
   Color c1 = new Color(166, 209, 241);
   Color c2 = new Color(204, 210, 211);
   JLabel label3 = new JLabel("Messaggi interni:");
   output.add(label3);
   outp.setBackground(c1);
   outp.setAutoscrolls(true);
   outp.setEditable(false);
   intmsg.setBackground(c2);
   intmsg.setAutoscrolls(true);
   intmsg.setEditable(false);
   output.add(scrollPaneM);
   JLabel label4 = new JLabel("Output:");
   output.add(label4);
   output.add(scrollPaneO);
   output.setBorder(BorderFactory.createEtchedBorder());
 }
Example #11
0
  public ShowComp() throws InterruptedException, IOException {
    super("CONNECTED COMPUTERS");
    int x = 0, d = 20;
    mb = new JMenuBar();
    File = new JMenu("File");
    mb.add(File);
    exit = new JMenuItem("Exit");
    exit.addActionListener(this);
    File.add(exit);
    ta = new JTextArea();
    ta.setBounds(20, 30, 315, 470);
    ta.setEditable(false);
    add(ta);

    setJMenuBar(mb);

    sel = new JLabel("The connected computers are..");
    sel.setBounds(15, 5, 300, 30);
    add(sel);
    b1 = new JButton("<< BACK");
    b1.setBounds(140, 510, 100, 30);
    b1.setToolTipText("Back to main page");
    b1.addActionListener(this);
    add(b1);
    setLayout(null);
    while (x < 360) {
      x = x + d;
      setBounds(675, 50, x, 600);
      this.show();
    }
    // setVisible(true);
    String s = "192.168.0.", temp = null;
    Printer printer = new Printer();
    printer.start();
    Connector connector = new Connector(printer);
    connector.start();

    LinkedList targets = new LinkedList();
    for (int i = 1; i <= 255; i++) {
      temp = s + Integer.toString(i);
      Target t = new Target(temp);
      targets.add(t);
      connector.add(t);
    }
    Thread.sleep(2000);
    connector.shutdown();
    connector.join();

    for (Iterator i = targets.iterator(); i.hasNext(); ) {
      Target t = (Target) i.next();
      if (!t.shown) t.show();
    }

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  }
Example #12
0
 public logMessages() {
   frame = new JFrame("Log Messages");
   panel = new JPanel();
   area = new JTextArea("", 12, 42);
   area.setEditable(false);
   spane = new JScrollPane(area);
   panel.add(spane);
   frame.add(panel);
   frame.setSize(500, 230);
   // frame.setResizable(false);
   frame.setVisible(false);
 }
Example #13
0
  // create and position GUI components; register event handlers
  private void createUserInterface() {
    // get content pane for attaching GUI components
    Container contentPane = getContentPane();

    // enable explicit positioning of GUI components
    contentPane.setLayout(null);

    // set up principalJLabel
    principalJLabel = new JLabel();
    principalJLabel.setBounds(20, 20, 80, 20);
    principalJLabel.setText("Principal:");
    contentPane.add(principalJLabel);

    // set up principalJTextField
    principalJTextField = new JTextField();
    principalJTextField.setBounds(80, 20, 90, 20);
    principalJTextField.setText("0");
    principalJTextField.setHorizontalAlignment(JTextField.RIGHT);
    contentPane.add(principalJTextField);

    // set up resultJLabel
    resultJLabel = new JLabel();
    resultJLabel.setBounds(20, 60, 100, 20);
    resultJLabel.setText("Result:");
    contentPane.add(resultJLabel);

    // set up resultJTextArea
    resultJTextArea = new JTextArea();
    resultJTextArea.setBounds(20, 85, 260, 120);
    resultJTextArea.setEditable(false);
    contentPane.add(resultJTextArea);

    // set up calculateJButton
    calculateJButton = new JButton();
    calculateJButton.setBounds(190, 20, 90, 20);
    calculateJButton.setText("Calculate");
    contentPane.add(calculateJButton);
    calculateJButton.addActionListener(
        new ActionListener() // anonymous inner class
        {
          // event handler called when calculateJButton is pressed
          public void actionPerformed(ActionEvent event) {
            calculateJButtonActionPerformed(event);
          }
        } // end anonymous inner class
        ); // end call to addActionListener

    // set properties of application's window
    setTitle("Comparing Rates"); // set title bar text
    setSize(310, 255); // set window size
    setVisible(true); // display window
  } // end method createUserInterface
  public void init() {
    task_name = new String[1];
    task_name[0] = "当前没有任务";
    task_description = "";
    jl_taskname = new JList(task_name);
    scrollpane1 = new JScrollPane(jl_taskname);

    jta_taskdescription = new JTextArea("", 20, 20);
    jta_taskdescription.setLineWrap(true);
    jta_taskdescription.setWrapStyleWord(true);
    jta_taskdescription.setEditable(true);
    scrollpane2 = new JScrollPane(jta_taskdescription);
  }
Example #15
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);
 }
  /**
   * @param shortcut dialog will be initialized with this <code>shortcut</code>. It can be <code>
   *     null</code> if dialog is used to create new mouse shortcut.
   */
  public MouseShortcutDialog(
      JComponent parentComponent,
      MouseShortcut shortcut,
      @NotNull Keymap keymap,
      @NotNull String actiondId,
      @NotNull Group mainGroup) {
    super(parentComponent, true);
    setTitle(KeyMapBundle.message("mouse.shortcut.dialog.title"));

    myKeymap = keymap;
    myActionId = actiondId;
    myMainGroup = mainGroup;

    myRbSingleClick =
        new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.single.click.radio"));
    myRbDoubleClick =
        new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.double.click.radio"));
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(myRbSingleClick);
    buttonGroup.add(myRbDoubleClick);

    myLblPreview = new JLabel(" ");

    myClickPad = new MyClickPad();

    myTarConflicts = new JTextArea();
    myTarConflicts.setFocusable(false);
    myTarConflicts.setEditable(false);
    myTarConflicts.setBackground(UIUtil.getPanelBackground());
    myTarConflicts.setLineWrap(true);
    myTarConflicts.setWrapStyleWord(true);

    if (shortcut != null) {
      if (shortcut.getClickCount() == 1) {
        myRbSingleClick.setSelected(true);
      } else {
        myRbDoubleClick.setSelected(true);
      }
      myButton = shortcut.getButton();
      myModifiers = shortcut.getModifiers();
    } else {
      myRbSingleClick.setSelected(true);
      myButton = -1;
      myModifiers = -1;
    }

    updatePreviewAndConflicts();

    init();
  }
  boolean initControlCenter(String title) {

    this.setTitle(title);
    // set up content pane
    Container content = this.getContentPane();
    content.setLayout(new BorderLayout());
    panelAbout.setLayout(new BorderLayout());

    JTextArea textArea =
        new JTextArea(
            "PlayStation 2 Virtual File System release 1.0 \n\nSpecials thanks to our betatester\nPS2Linux Betatester: Mrbrown and Sarah\nPS2 betatester: Oobles, Caveman, Gamebytes, Ping^Spike, Josekenshin, Padawan, pakor, SandraThx and Rolando\n\nAdded little gui in java swing\nAdded feature to choose directory for media files\nAdded support for properties files\nCheck for updates at ps2dev.org\n\nRelease 1.2\n\nRewrite io with java NIO\nadded console mode support\n");
    textArea.setEditable(false);

    JScrollPane areaScrollPane = new JScrollPane(textArea);
    areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    areaScrollPane.setPreferredSize(new Dimension(250, 250));
    TitledBorder aboutBorder = BorderFactory.createTitledBorder("Change log and Greets");
    aboutBorder.setTitleColor(Color.blue);
    panelAbout.setBorder(aboutBorder);

    panelAbout.add(areaScrollPane);
    // set up tabbed pane
    content.add(jtpMain);

    jtpMain.addTab("Configure", panelChooser);
    jtpMain.addTab("About", panelAbout);
    //  set up display area
    // jtaDisplay.setEditable(false);
    // jtaDisplay.setLineWrap(true);
    // jtaDisplay.setMargin(new Insets(5, 5, 5, 5));
    // jtaDisplay.setFont(
    // new Font("Monospaced", Font.PLAIN, iDEFAULT_FontSize));
    // jspDisplay.setViewportView(jtaDisplay);
    // jspDisplay.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
    // panelConsole.add(jspDisplay, BorderLayout.CENTER);
    // panelConsole.add(jtfCommand, BorderLayout.SOUTH);
    // panelConsole.add(jtaDisplay, BorderLayout.CENTER);

    // listener: window closer
    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });

    this.vResize();
    return true;
  }
Example #18
0
  /**
   * This method initializes jTextArea
   *
   * @return javax.swing.JTextArea
   */
  private JTextArea getJTextArea() {
    if (installDirTextArea == null) {

      String path;

      path = System.getProperty("user.home");

      installDirTextArea = new JTextArea();
      installDirTextArea.setEditable(false);
      installDirTextArea.setText(System.getProperty("user.home"));

      installDirTextArea.setBounds(new Rectangle(13, 49, 206, 21));
    }
    return installDirTextArea;
  }
Example #19
0
    public HelpFrame(JFrame f) {
      super("Help menu");
      setSize(320, 240);
      setLocationRelativeTo(f);
      setResizable(false);

      JTextArea message = new JTextArea();
      message.setEditable(false);
      message.setText(
          "Default keybindings:\n     -Cmd+e to toggle terminal\n     -Cmd+k to run\n     -Cmd+/ to show help\n     -Cmd+o for options\n\n"
              + "Special keywords: \n     -'import' can be typed anywhere \n     -'method' and then a method will compile\n\n"
              + "Other: \n     -You can also use this for normal Java editing!");

      add(message, "Center");
      setVisible(true);
    }
Example #20
0
  private void buildInterface() {

    // Panel p to hold the label and text field
    JPanel panelInput = new JPanel();
    panelInput.setLayout(new BorderLayout());
    panelInput.add(buttonSelect, BorderLayout.EAST);
    panelInput.add(textFolder, BorderLayout.CENTER);
    textFolder.setEditable(false);
    textFolder.setText(System.getProperty("user.home") + "\\"); // Set default save location

    setLayout(new BorderLayout());
    add(panelInput, BorderLayout.NORTH);
    add(new JScrollPane(textArea), BorderLayout.CENTER);
    textArea.setEditable(false);

    buttonSelect.setToolTipText(TOOL_TIP_SELECT_FOLDER);
    buttonSelect.addActionListener(new ButtonListener()); // Register listener
  }
Example #21
0
  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);
  }
  public ExecuteVisualizer() {
    // Set textarea properties
    jtaInstructions.setWrapStyleWord(true);
    jtaInstructions.setLineWrap(true);
    jtaInstructions.setEditable(false);

    // Set ExecuteVisualizer frame layout and add components to the frame
    setLayout(new BorderLayout(5, 10));
    add(jtaInstructions, BorderLayout.CENTER);
    add(jbtStart, BorderLayout.SOUTH);

    // Set Options frame attributes
    optionsFrame.setSize(250, 350);
    optionsFrame.setTitle("Options");
    optionsFrame.setResizable(false);
    optionsFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Set VisualizerFrame attributes
    vFrame.setSize(800, 475);
    vFrame.setTitle("Beats visualized");
    vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    vFrame.setLocationRelativeTo(null);

    // Set colorChoose frame attributes
    colorChooser.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ColorChooser newContentPane = new ColorChooser();
    newContentPane.setOpaque(true); // content panes must be opaque
    colorChooser.setContentPane(newContentPane);
    colorChooser.setResizable(false);

    // Add listener to button which will open Options, VisualizerFrame
    // and colorChoose frame, and close the current frame
    jbtStart.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            optionsFrame.setVisible(true);
            vFrame.setVisible(true);
            colorChooser.pack();
            colorChooser.setVisible(true);
            dispose();
          }
        });
  }
  public FileChooserDemo() {
    super(new BorderLayout());

    // Create the log first, because the action listeners
    // need to refer to it.
    log = new JTextArea(5, 20);
    log.setMargin(new Insets(5, 5, 5, 5));
    log.setEditable(false);
    JScrollPane logScrollPane = new JScrollPane(log);

    // Create a file chooser
    fc = new JFileChooser();

    // Uncomment one of the following lines to try a different
    // file selection mode.  The first allows just directories
    // to be selected (and, at least in the Java look and feel,
    // shown).  The second allows both files and directories
    // to be selected.  If you leave these lines commented out,
    // then the default mode (FILES_ONLY) will be used.
    //
    // fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    // fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);

    // Create the open button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    openButton = new JButton("Open a File...", createImageIcon("images/Open16.gif"));
    openButton.addActionListener(this);

    // Create the save button.  We use the image from the JLF
    // Graphics Repository (but we extracted it from the jar).
    saveButton = new JButton("Save a File...", createImageIcon("images/Save16.gif"));
    saveButton.addActionListener(this);

    // For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel(); // use FlowLayout
    buttonPanel.add(openButton);
    buttonPanel.add(saveButton);

    // Add the buttons and the log to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(logScrollPane, BorderLayout.CENTER);
  }
Example #24
0
  /**
   * Creates a new instance of ListInputPanel with initialized components.
   *
   * @param file_parser An object that can bring up a file chooser, parse selected files and append
   *     the extracted contents to this object's text area. The Load button is disabled if this is
   *     null.
   */
  public ListInputPanel(ListInputParser file_parser) {
    // Call superclass constructor
    super(new BorderLayout(4, 4));

    // Store the file parser
    this.file_parser = file_parser;

    // Initialize layout settings
    int horizontal_gap = 4;
    int vertical_gap = 4;

    // Set up the button panel and attach action listeners to the buttons
    JPanel button_panel = new JPanel(new GridLayout(1, 4));
    load_button = new JButton("Load");
    save_button = new JButton("Save");
    clear_button = new JButton("Clear");
    organize_button = new JButton("Organize");
    button_panel.add(load_button);
    button_panel.add(save_button);
    button_panel.add(clear_button);
    button_panel.add(organize_button);
    save_button.addActionListener(this);
    load_button.addActionListener(this);
    clear_button.addActionListener(this);
    organize_button.addActionListener(this);

    // Disable the load button if appropriate
    if (file_parser == null) load_button.setEnabled(false);

    // Prepare text_area
    text_area = new JTextArea();
    text_area.setLineWrap(false);
    text_area.setEditable(true);
    text_area.setText("");

    // Make scrollable
    JScrollPane scroll_pane = new JScrollPane(text_area);

    // Add contents to this JPanel
    add(button_panel, BorderLayout.NORTH);
    add(scroll_pane, BorderLayout.CENTER);
  }
Example #25
0
  /** 创建对话框面板 */
  private void createPanel() {

    textArea = new JTextArea();
    textArea.setEditable(false);
    textArea.setFont(new Font("aFont", Font.PLAIN, 12));

    receiveTxt();

    JPanel panel = new JPanel();
    JButton button = new JButton("确定");
    panel.add(button);

    add(textArea, BorderLayout.CENTER);
    add(panel, BorderLayout.SOUTH);

    button.addActionListener(
        (ActionEvent e) -> {
          setVisible(false);
        });
  }
Example #26
0
  public WachtlijstPaneel() {

    knop = new JButton("Schuif op");
    knop.addActionListener(this);
    veld1 = new JTextField(13);
    veld1.addActionListener(this);
    veld2 = new JTextField(13);
    veld3 = new JTextField(13);
    veld4 = new JTextField(13);
    textveld1 = new JTextArea(15, 13);
    add(veld1);
    add(knop);
    add(veld2);
    add(veld3);
    add(veld4);
    add(textveld1);
    veld2.setEditable(false);
    veld3.setEditable(false);
    veld4.setEditable(false);
    textveld1.setEditable(false);
  }
Example #27
0
  public GUI() {
    String[] keys = {"no Quotation found"};
    if (tryDir(".") || tryDir("BLM305") || tryDir("CSE470")) keys = Q.keySet().toArray(keys);
    menu = new JComboBox<String>(keys);
    if (Q.size() > 0) setMessage(0);

    JPanel pan = new JPanel();
    pan.setLayout(new BorderLayout(GAP, GAP - 4));
    pan.setBorder(new javax.swing.border.EmptyBorder(GAP, GAP, GAP, GAP));
    pan.setBackground(COLOR);

    pan.add(topPanel(), "North");

    txt.setFont(LARGE);
    txt.setEditable(false);
    txt.setRows(5);
    txt.setColumns(30);
    txt.setWrapStyleWord(true);
    txt.setLineWrap(true);
    txt.setDragEnabled(true);
    pan.add(new JScrollPane(txt), "Center");

    ref.setFont(SMALL);
    ref.setEditable(false);
    ref.setColumns(35);
    ref.setDragEnabled(true);
    pan.add(ref, "South");

    pan.setToolTipText("A project realized collectively by the class");
    menu.setToolTipText("Quotation classes");
    who.setToolTipText("author()+year()");
    txt.setToolTipText("text()");
    ref.setToolTipText("reference()");

    frm.setContentPane(pan);
    frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frm.setLocation(scaled(120), scaled(90));
    frm.pack();
    frm.setVisible(true);
  }
Example #28
0
  /**
   * Builds the components from the file and displays it.
   *
   * @param strFile the file to be read.
   */
  public void build(int nType, String strFile, String strhelpfile) {
    m_nType = nType;
    m_strPath = (strFile != null) ? FileUtil.openPath(strFile) : "";
    m_strHelpFile = strhelpfile;
    boolean bValidate = false;
    boolean bChecksum = false;

    if (nType == CONFIG) {
      setTitle("Configuration");
      buildConfig();
    } else {
      JComponent compDisplay = null;
      if (nType == DEFAULT) {
        m_pnlAccPolicy = new AccPolicyPanel(m_strPath);
        compDisplay = m_pnlAccPolicy;
        setTitle("Password Configuration");
      } else if (nType == CHECKSUM) {
        m_pnlChecksum = new ChecksumPanel(m_strPath);
        compDisplay = m_pnlChecksum;
        setTitle("Checksum Configuration");
        bValidate = true;
        bChecksum = true;
      } else {
        setTitle("Perform System Validation");
        compDisplay = new JTextArea();
        ((JTextArea) compDisplay).setEditable(false);
        bValidate = true;
        doBlink();
      }
      m_pnlDisplay.removeAll();
      m_pnlDisplay.setLayout(new BorderLayout());
      m_pnlDisplay.add(compDisplay, BorderLayout.CENTER);
      setVisible(true);
    }
    validateButton.setVisible(bValidate);
    // abandonButton.setVisible(!bValidate);
    setAbandonEnabled(bValidate);
    m_btnChecksum.setVisible(bChecksum);
  }
Example #29
0
  public Splitter() {
    super(new BorderLayout());

    // Create the demo's UI.
    startButton = new JButton("Start");
    startButton.setActionCommand("start");
    startButton.addActionListener(this);
    startButton.setVisible(false);

    taskOutput = new JTextArea(30, 130);
    taskOutput.setMargin(new Insets(5, 5, 5, 5));
    taskOutput.setEditable(false);

    JPanel panel = new JPanel();
    panel.add(startButton);

    add(panel, BorderLayout.PAGE_START);
    add(new JScrollPane(taskOutput), BorderLayout.CENTER);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    startButton.doClick();
  }
  public void go() {
    frame = new JFrame("Quiz Card Player");
    JPanel mainPanel = new JPanel();
    Font bigFont = new Font("sanserif", Font.BOLD, 24);

    display = new JTextArea(10, 20);
    display.setFont(bigFont);
    display.setLineWrap(true);
    display.setEditable(false);

    JScrollPane qScroller = new JScrollPane(display);
    qScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    qScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    nextButton = new JButton("Show Questions");
    nextButton.addActionListener(new NextCardListener());

    mainPanel.add(qScroller);
    mainPanel.add(nextButton);

    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");
    JMenuItem loadMenuItem = new JMenuItem("Load Card Set");
    loadMenuItem.addActionListener(new OpenMenuListener());
    fileMenu.add(loadMenuItem);
    menuBar.add(fileMenu);

    frame.setJMenuBar(menuBar);
    frame.getContentPane().add(BorderLayout.CENTER, mainPanel);
    frame.setSize(640, 500);
    frame.setVisible(true);
  }