Example #1
2
  /** Inicializace základních komponent okna */
  private void init() {

    krokLabel = new JLabel("Synchronizace s web aplikací");
    Font pismo = new Font("Arial", Font.BOLD, 14);
    krokLabel.setFont(pismo);
    NacitaciOkno.add(krokLabel);
    krokLabel.setBounds(90, 10, 250, 20);

    startButton = new JButton("Načíst");
    startButton.setActionCommand("start");
    startButton.setBounds(250, 110, 120, 25);
    startButton.addActionListener(new Start());

    progressBar = new JProgressBar(0, 100);
    progressBar.setBounds(20, 60, 350, 25);
    progressBar.setValue(0);

    progressBar.setStringPainted(true);

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

    NacitaciOkno.add(startButton);
    NacitaciOkno.add(progressBar);

    NacitaciOkno.setVisible(true);

    vybratButton = new JButton("Otevřít");
    NacitaciOkno.add(vybratButton);
    vybratButton.setBounds(20, 110, 120, 25);
    vybratButton.addActionListener(new Zpet());
  }
  public void search() {
    hilit.removeAllHighlights();

    String s = entry.getText();
    if (s.length() <= 0) {
      message("Nothing to search");
      return;
    }

    String content = textArea.getText();
    int index = content.indexOf(s, 0);
    if (index >= 0) {
      try {
        int end = index + s.length();
        hilit.addHighlight(index, end, painter);
        textArea.setCaretPosition(end);
        entry.setBackground(entryBg);
        message("'" + s + "' found. Press ESC to end search");
      } catch (BadLocationException e) {
        e.printStackTrace();
      }
    } else {
      entry.setBackground(ERROR_COLOR);
      message("'" + s + "' found. Press ESC to start a new search");
    }
  }
Example #3
0
 public SISCFrame(AppContext ctx) {
   setLayout(new BorderLayout());
   SchemePanel.SchemeDocument d = new SchemePanel.SchemeDocument();
   sp = new SchemePanel(ctx, d, new JTextPane(d));
   input = new JTextArea(4, 70);
   input.setText("; Enter s-expressions here");
   JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, sp, input);
   JPanel execPanel = new JPanel();
   execPanel.setLayout(new BoxLayout(execPanel, BoxLayout.X_AXIS));
   execPanel.add(Box.createHorizontalGlue());
   eval = new JButton("Evaluate");
   clear = new JButton("Clear");
   autoClear = new JCheckBox("Auto-Clear");
   submitOnEnter = new JCheckBox("Evaluate on Enter");
   autoClear.setSelected(true);
   submitOnEnter.setSelected(true);
   execPanel.add(submitOnEnter);
   execPanel.add(autoClear);
   execPanel.add(clear);
   execPanel.add(eval);
   add(split, BorderLayout.CENTER);
   add(execPanel, BorderLayout.SOUTH);
   eval.addActionListener(this);
   clear.addActionListener(this);
   input.addKeyListener(this);
   /*	addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
   System.exit(0);
         }
         });*/
 }
Example #4
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();
      }
    }
 @Override
 public void actionPerformed(ActionEvent e) {
   String text = textArea.getText();
   textArea.append("\n\nbutton clicked");
   JOptionPane.showMessageDialog(null, "Your message is:  " + text);
   System.out.println(text);
 }
Example #6
0
  private void initUI() {
    JPanel panel = new JPanel();

    JTextArea area = new JTextArea("Text zona");
    area.setPreferredSize(new Dimension(100, 100));

    JButton button = new JButton("Buton");
    button.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            System.exit(0);
          }
        });
    panel.add(button);

    JTree tree = new JTree();
    panel.add(tree);
    panel.add(area);

    add(panel);
    pack();

    setTitle("Fereastra layout flow");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLocationRelativeTo(null);
  }
  // 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);
  }
  private void addItem() {
    if (!searchName.getText().isEmpty() && !item.getText().isEmpty()) {

      try {
        Main.setItem(
            searchName.getText(),
            "http://www.reddit.com/r/hardwareswap/search?q="
                + item.getText()
                + "&sort=new&restrict_sr=on");

        results.setText("Current Items");

        displayInformation();

      } catch (IOException e1) {
        e1.printStackTrace();
      }

      searchName.setText("");
      item.setText("");

    } else {

      results.setText("Please provide all info for Item Name, Keyword, and Website");
    }
  }
 public MyPanel() {
   JButton button = new JButton("Talk to Mortens Server");
   final JTextArea textArea = new JTextArea();
   JScrollPane scrollPane = new JScrollPane(textArea);
   textArea.setWrapStyleWord(true);
   textArea.setLineWrap(true);
   button.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           try {
             URLConnection urlConnection =
                 new URL(
                         "http://213.173.255.177:8081/funnystuff/Servlet267944?name="
                             + System.getProperty("user.name").replaceAll(" ", "%20"))
                     .openConnection();
             InputStream inputStream = urlConnection.getInputStream();
             textArea.append(
                 new BufferedReader(new InputStreamReader(inputStream)).readLine() + "\n");
           } catch (IOException e1) {
             e1.printStackTrace();
           }
         }
       });
   setLayout(new BorderLayout());
   JPanel panel2 = new JPanel();
   panel2.add(button);
   add(panel2, BorderLayout.WEST);
   add(scrollPane, BorderLayout.CENTER);
 }
  public void findNext() {
    String selection = txt.getSelectedText();
    try {
      selection.equals("");
    } catch (NullPointerException e) {
      selection = textF.getText();
      try {
        selection.equals("");
      } catch (NullPointerException e2) {
        selection = JOptionPane.showInputDialog("Find:");
        textF.setText(selection);
      }
    }
    try {
      int select_start = txt.getText().toLowerCase().indexOf(selection.toLowerCase(), startIndex);
      int select_end = select_start + selection.length();
      txt.select(select_start, select_end);
      startIndex = select_end + 1;

      if (select_start == txt.getText().toLowerCase().lastIndexOf(selection.toLowerCase())) {
        startIndex = 0;
      }
    } catch (NullPointerException e) {
    }
  }
  @Override
  public JComponent createContentPanel() {
    JPanel panel = new JPanel(new BorderLayout(10, 10));
    panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10));

    JLabel label = new JLabel("Initial Focused Component: ");
    label.setDisplayedMnemonic('I');
    label.setHorizontalAlignment(SwingConstants.CENTER);

    JTextField textField = new JTextField();
    label.setLabelFor(textField);

    JPanel topPanel = new JPanel(new BorderLayout(6, 6));
    topPanel.add(label, BorderLayout.BEFORE_LINE_BEGINS);
    topPanel.add(textField, BorderLayout.CENTER);
    panel.add(topPanel, BorderLayout.BEFORE_FIRST_LINE);

    JTextArea textArea = new MultilineLabel();
    textArea.setColumns(50);
    textArea.setRows(20);
    textArea.setText(
        "This is an example using StandardDialog."
            + "\n\nIn this example, we create a dialog with banner, some example contents in content area, and a button panel with three buttons at the bottom of the dialog.");
    panel.add(new JScrollPane(textArea), BorderLayout.CENTER);
    setInitFocusedComponent(textField);
    return panel;
  }
  private void initializeUI() {
    this.setLayout(new BorderLayout());
    this.setPreferredSize(new Dimension(400, 200));

    JLabel label = new JLabel("Tab size: ");
    Object[] items = {2, 4, 8, 10, 20};
    final JComboBox comboBox = new JComboBox(items);

    JPanel tabPanel = new JPanel(new FlowLayout());
    tabPanel.add(label);
    tabPanel.add(comboBox);

    this.add(tabPanel, BorderLayout.NORTH);

    final JTextArea textArea = new JTextArea();
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);

    //
    // Sets the number of characters to expand tabs to.
    //
    textArea.setTabSize((Integer) comboBox.getSelectedItem());
    comboBox.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            textArea.setTabSize((Integer) comboBox.getSelectedItem());
          }
        });

    JScrollPane pane = new JScrollPane(textArea);
    pane.setPreferredSize(new Dimension(400, 200));
    pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    this.add(pane, BorderLayout.CENTER);
  }
Example #13
0
  public void afficherFilmChoisis(String titre) {
    Video film = this.obtenirVideo(titre);
    String catos =
        this.obtenirCategoriesEnString(
            comboCollection.getItemAt(comboCollection.getSelectedIndex()).toString());
    if (mode[0].isSelected()) {
      String filmOuSerie = "SERIE TV";
      String eval = "";
      if (film.getEval() == 1) {
        eval = String.valueOf(film.getEval()) + " etoile";
      } else if (film.getEval() > 1) {
        eval = String.valueOf(film.getEval()) + " etoiles";
      }
      if (film.isFilm()) {
        filmOuSerie = "FILM";
      }
      infos_film[0].setText(titre);
      infos_film[1].setText(String.valueOf(film.getAnnee()));
      infos_film[2].setText(filmOuSerie);
      infos_film[3].setText(eval);
    } else {

      textTitre.setText(film.getTitre());
      textAnnee.setText(String.valueOf(film.getAnnee()));
      comboEval.setSelectedIndex(film.getEval());
      boolean isFilm = film.isFilm();
      if (isFilm) {
        comboType.setSelectedIndex(1);
      } else {
        comboType.setSelectedIndex(2);
      }
    }
    textCommentaires.setText(film.getCommentaires());
    textCategories.setText(catos);
  }
Example #14
0
  public void save() {
    for (String key : fields.keySet()) {
      JComponent comp = fields.get(key);

      if (comp instanceof JTextField) {
        JTextField c = (JTextField) comp;

        if (c.getText().trim().equals("")) {
          sketch.configFile.unset(key);
        } else {
          sketch.configFile.set(key, c.getText());
        }
      } else if (comp instanceof JTextArea) {
        JTextArea c = (JTextArea) comp;

        if (c.getText().trim().equals("")) {
          sketch.configFile.unset(key);
        } else {
          sketch.configFile.set(key, c.getText());
        }
      }
    }

    sketch.saveConfig();
  }
 private void setBackgroundColors() {
   shellPreview.setBackground(themeData.getColor(ThemeData.SHELL_BACKGROUND_COLOR));
   shellPreview.setSelectionColor(themeData.getColor(ThemeData.SHELL_SELECTED_BACKGROUND_COLOR));
   historyPreview.setBackground(themeData.getColor(ThemeData.SHELL_HISTORY_BACKGROUND_COLOR));
   historyPreview.setSelectionBackground(
       themeData.getColor(ThemeData.SHELL_HISTORY_SELECTED_BACKGROUND_COLOR));
 }
Example #16
0
 public void updateStatus() {
   txaStatus.setText("");
   txaStatus.append("size\t" + store.getRowCount() + "\n");
   txaStatus.append("total\t" + store.sumLengths() + "KB\n");
   txaStatus.append("\nThreads:\n");
   for (int i = 0; i < numThreads; i++) {
     txaStatus.append(" " + i + "- ");
     String jb = encryptDecryptThreads[i].getCur();
     if (jb == null) txaStatus.append("idle\n");
     else {
       txaStatus.append(jobString(jb) + "\n");
     }
   }
   txaStatus.append("\nJobs:\n");
   int c = 6 + numThreads;
   int i = 0;
   synchronized (jobs) {
     for (String s : jobs) {
       if (c + i < TXA_HEIGHT - 1) txaStatus.append(" - " + jobString(s) + "\n");
       else if (c + i == TXA_HEIGHT - 1) {
         txaStatus.append(" - [" + (jobs.size() - i) + "more ]");
       }
       i++;
     }
   }
 }
  @Override
  protected JPanel createFormPanel() {
    JPanel mainPanel = new JPanel();
    JScrollPane scroll = new JScrollPane();
    JTextArea textArea = new JTextArea();

    textArea.setColumns(20);
    textArea.setRows(5);
    scroll.setViewportView(textArea);

    textArea.setText(HELP_TXT);
    textArea.setEditable(false);

    GroupLayout layout = new GroupLayout(mainPanel);
    mainPanel.setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE)
                    .addContainerGap()));
    return mainPanel;
  }
Example #18
0
  private JPanel getJContentPane() {
    if (jContentPane == null) {
      jLabel6 = new JLabel();
      jLabel6.setBounds(new Rectangle(11, 72, 218, 19));
      jLabel6.setText("Install log directory:");
      jLabel5 = new JLabel();
      jLabel5.setBounds(new Rectangle(11, 2, 394, 26));
      jLabel5.setText("Advanced Install. Please select your preferences");
      ButtonGroup group = new ButtonGroup();
      pathSuffix = new JTextArea();
      pathSuffix.setBounds(new Rectangle(232, 48, 61, 21));
      pathSuffix.setText("BIRCH");
      jLabel4 = new JLabel();
      jLabel4.setBounds(new Rectangle(22, 351, 312, 20));
      jLabel4.setText("* - Automatically detected, recommended.");
      jLabel3 = new JLabel();
      jLabel3.setBounds(new Rectangle(220, 48, 10, 21));
      jLabel3.setText(" /");
      jLabel2 = new JLabel();
      jLabel2.setBounds(new Rectangle(18, 250, 132, 18));
      jLabel2.setText("Binaries:");
      jLabel1 = new JLabel();
      jLabel1.setBounds(new Rectangle(11, 115, 127, 21));
      jLabel1.setText("Framework Type:");
      jLabel = new JLabel();
      jLabel.setBounds(new Rectangle(11, 28, 131, 17));
      jLabel.setText("Install directory:");
      jContentPane = new JPanel();
      jContentPane.setLayout(null);
      jContentPane.setSize(new Dimension(464, 376));
      jContentPane.add(jLabel, null);
      jContentPane.add(getJButton(), null);
      jContentPane.add(getJTextArea(), null);
      jContentPane.add(jLabel3, null);
      jContentPane.add(pathSuffix, null);
      jContentPane.add(jLabel1, null);
      jContentPane.add(getJCheckBox(), null);
      jContentPane.add(getJCheckBox1(), null);
      jContentPane.add(jLabel2, null);
      jContentPane.add(getJCheckBox2(), null);
      jContentPane.add(getJCheckBox3(), null);
      jContentPane.add(getJCheckBox4(), null);
      jContentPane.add(getJCheckBox5(), null);
      jContentPane.add(getJCheckBox6(), null);

      jContentPane.add(getLogTextField(), null);
      jContentPane.add(getLogButton(), null);
      jContentPane.add(jLabel4, null);
      jContentPane.add(getWindows32Checkbox(), null);
      jContentPane.add(getJRadioButton(), null);
      jContentPane.add(jLabel5, null);
      jContentPane.add(jLabel6, null);
      jContentPane.add(getGitRadioButton(), null);
      jContentPane.add(getGitComboBox(), null);
      group.add(releaseRadioButton);
      group.add(developmentRadioButton);
      group.add(gitRadioButton);
    }
    return jContentPane;
  }
Example #19
0
  public synchronized void run() {

    byte[] buffer = new byte[BUFFER_SIZE];

    for (; ; ) {
      try {
        this.wait(100);
      } catch (InterruptedException ie) {
      }

      int len = 0;
      try {
        int noBytes = pin.available();

        if (noBytes > 0) {
          len = pin.read(buffer, 0, Math.min(noBytes, BUFFER_SIZE));
          if (len > 0) {
            jTextArea.append(new String(buffer, 0, len));
            jTextArea.setCaretPosition(jTextArea.getText().length());
          }
        }
      } catch (IOException ioe) {
        throw new UIError("Unable to read from input stream! " + ioe.getMessage());
      }
    }
  }
  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 #21
0
  private void _displayRespStrInFrame() {

    final JFrame frame = new JFrame("Google Static Map - Error");
    GUIUtils.setAppIcon(frame, "69.png");
    // frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    JTextArea response = new JTextArea(_respStr, 25, 80);
    response.addMouseListener(
        new MouseListener() {
          public void mouseClicked(MouseEvent e) {}

          public void mousePressed(MouseEvent e) {
            /*frame.dispose();*/
          }

          public void mouseReleased(MouseEvent e) {}

          public void mouseEntered(MouseEvent e) {}

          public void mouseExited(MouseEvent e) {}
        });

    frame.setContentPane(new JScrollPane(response));
    frame.pack();

    GUIUtils.centerOnScreen(frame);
    frame.setVisible(true);
  }
Example #22
0
	public void actionPerformed(ActionEvent e)
	{
		if(e.getSource()==b)
		{
			temp=tf.getText();
			temp1[]=ta.getText().split();
			index=0;
			index=temp1[].indexOf(temp,index);
			ta.select(index, index+temp.length());
			b.setVisible(false);
			b1.setVisible(true);
		}
		if(e.getSource()==b1)
		{
			index=temp1.indexOf(temp,index+temp.length());
			if(index!=-1)
			{
				ta.requestFocusInWindow();
				ta.select(index, index+temp.length());
			}
			else
			{
				b.setVisible(true);
				b1.setVisible(false);
				index=0;
			}
		}
	}	
Example #23
0
  /**
   * Creates a dialog that is showing the histogram for the given node (if null one is selected for
   * you)
   */
  private JPanel createNormalityTestDialog(Node selected) {
    DataSet dataSet = (DataSet) dataEditor.getSelectedDataModel();

    QQPlot qqPlot = new QQPlot(dataSet, selected);
    NormalityTestEditorPanel editorPanel = new NormalityTestEditorPanel(qqPlot, dataSet);

    JTextArea display =
        new JTextArea(
            NormalityTests.runNormalityTests(
                dataSet, (ContinuousVariable) qqPlot.getSelectedVariable()),
            20,
            65);
    display.setEditable(false);
    editorPanel.addPropertyChangeListener(new NormalityTestListener(display));

    Box box = Box.createHorizontalBox();
    box.add(display);

    box.add(Box.createHorizontalStrut(3));
    box.add(editorPanel);
    box.add(Box.createHorizontalStrut(5));
    box.add(Box.createHorizontalGlue());

    Box vBox = Box.createVerticalBox();
    vBox.add(Box.createVerticalStrut(15));
    vBox.add(box);
    vBox.add(Box.createVerticalStrut(5));

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    panel.add(vBox, BorderLayout.CENTER);

    return panel;
  }
Example #24
0
  public void save() {
    BufferedWriter sourceFile = null;

    try {
      String sourceText = sourceArea.getText();

      String cleanText = cleanupSource(sourceText);

      if (cleanText.length() != sourceText.length()) {
        sourceArea.setText(cleanText);

        String message =
            String.format(
                "One or more invalid characters at the end of the source file have been removed.");
        JOptionPane.showMessageDialog(this, message, "ROPE", JOptionPane.INFORMATION_MESSAGE);
      }

      sourceFile = new BufferedWriter(new FileWriter(sourcePath, false));
      sourceFile.write(cleanText);

      setSourceChanged(false);

      setupMenus();
    } catch (IOException ex) {
      ex.printStackTrace();
    } finally {
      if (sourceFile != null) {
        try {
          sourceFile.close();
        } catch (IOException ignore) {
        }
      }
    }
  }
    private void addComponents() {
      this.setLayout(new BorderLayout());
      this.setSize(new Dimension(350, 200));
      // set display location
      Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
      this.setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);

      textArea = new JTextArea();
      textArea.setLineWrap(true);
      textArea.setEditable(false);
      textArea.setBorder(BorderFactory.createLineBorder(Color.gray));
      JScrollPane scrollPane =
          new JScrollPane(
              textArea,
              JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
              JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      scrollPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
      this.add(scrollPane, BorderLayout.CENTER);

      JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
      JButton closeButton = new JButton("Close");
      closeButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              PopupDialog.this.setVisible(false);
            }
          });
      buttonPanel.add(closeButton);
      this.add(buttonPanel, BorderLayout.SOUTH);
    }
  protected void showErrorPage(final ErrorInfo info) {
    storeState();
    hideProgress();
    myRootComponent = null;

    myErrorMessages.removeAll();

    if (info.myShowStack) {
      info.myMessages.add(
          0, new FixableMessageInfo(true, info.myDisplayMessage, "", "", null, null));

      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      info.myThrowable.printStackTrace(new PrintStream(stream));
      myErrorStack.setText(stream.toString());
      myErrorStackLayout.show(myErrorStackPanel, ERROR_STACK_CARD);
    } else {
      myErrorStack.setText(null);
      myErrorStackLayout.show(myErrorStackPanel, ERROR_NO_STACK_CARD);
    }

    for (FixableMessageInfo message : info.myMessages) {
      addErrorMessage(
          message, message.myErrorIcon ? Messages.getErrorIcon() : Messages.getWarningIcon());
    }

    myErrorPanel.revalidate();
    myLayout.show(this, ERROR_CARD);

    DesignerToolWindowManager.getInstance(getProject()).refresh(true);
    repaint();
  }
Example #27
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);
  }
  public NotificacioGenerica(String missatge) {
    frame = new JFrame("Notificació");
    frame.getContentPane().setLayout(new GridBagLayout());
    label = new JTextArea(missatge);
    label.setEnabled(false);
    label.setEditable(false);
    button = new JButton("D'acord!");
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    frame.getContentPane().add(label, c);
    c.gridy = 1;
    frame.getContentPane().add(button, c);
    button.requestFocusInWindow();

    button.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent actionEvent) {
            frame.dispose();
          }
        });

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    pack();
    mostra(true);
  }
  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);
  }
Example #30
-1
  private void saveItem() {

    File f = new File("config.txt");

    if (f.exists() && !f.isDirectory()) {

      try (PrintWriter out =
          new PrintWriter(new BufferedWriter(new FileWriter("config.txt", true)))) {
        if (!searchName.getText().equals("") && !item.getText().equals("")) {

          out.println(
              searchName.getText()
                  + ","
                  + "http://www.reddit.com/r/hardwareswap/search?q="
                  + item.getText()
                  + "&sort=new&restrict_sr=on");
          addItem();

        } else {

          results.setText("Please provide all info for Search Name and Item");
        }

      } catch (IOException e1) {
        results.append("Error saving to file.");
      }

    } else {
      Main.checkFiles();
    }
  }