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
1
  /**
   * Returns a JTextArea in a scroll pane
   *
   * @return JTextArea in a scroll pane
   */
  protected JComponent getCenterComponent() {
    // visually placed in the south !
    lineCounter = new LineCounterField();
    lineCounter.setBorder(BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, 0, 0));
    // end of visually placed in the south

    saveAction = new SaveAction(getLocalizer().localize("button.save"));

    // text area
    textArea = new JTextArea();
    textArea.setLineWrap(false);
    textArea.setEditable(true);
    textArea.addCaretListener(lineCounter);
    textArea
        .getKeymap()
        .addActionForKeyStroke(
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK), saveAction);
    loadFile();
    JScrollPane contentScrollPane = new JScrollPane(textArea);
    contentScrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
    Rectangle screen = getGraphicsConfiguration().getBounds();
    contentScrollPane.setPreferredSize(
        new Dimension(Math.min(screen.width / 3, 420), Math.min(2 * screen.height / 3, 560)));
    return contentScrollPane;
  }
 @Override
 public void write(int b) throws IOException {
   // redirects data to the text area
   textArea.append(String.valueOf((char) b));
   // scrolls the text area to the end of data
   textArea.setCaretPosition(textArea.getDocument().getLength());
 }
Example #5
0
 /**
  * Show the description for a given project
  *
  * @param projectName The project name
  */
 private void generateGUIDescription(String projectName) {
   File proj =
       new File(
           Configuration.sourceDirPrefix
               + "/"
               + Configuration.projectDirInSourceFolder
               + "/"
               + projectName
               + "/"
               + Configuration.descriptionFileName);
   try {
     if (!proj.exists()) {
       descriptionText.setText("There is no description-file in the currently selected project.");
     } else {
       LineNumberReader r = new LineNumberReader(new FileReader(proj));
       String description = "";
       String tmp = null;
       while ((tmp = r.readLine()) != null) {
         description += tmp + "\n";
       }
       descriptionText.setText(description);
       descriptionText.setCaretPosition(0);
     }
   } catch (FileNotFoundException e) {
     descriptionText.setText("There is no description-file in the currently selected project.");
   } catch (IOException e) {
     Main.minorError(e);
     descriptionText.setText("There is no description-file in the currently selected project.");
   }
 }
Example #6
0
  public void limparTela() {

    codigoCatalogoField.setText("");
    tituloField.setText("");
    tituloOriginalField.setText("");
    escritorField.setText("");
    tradutorField.setText("");
    anoPrimEdicaoField.setText("");
    anoLancamentoField.setText("");
    edicaoField.setText("");
    qtdPageField.setText("");
    linguagemField.setText("");
    generoField.setText("");
    categoriaField.setText("");
    formatoField.setText("");
    editoraField.setText("");
    paisLancamentoField.setText("");
    codigoBarraField.setText("");
    codigoCDDField.setText("");
    codigoCDUField.setText("");
    sinopseArea.setText("");
    seriesArea.setText("");
    obsArea.setText("");
    capaField.setText("");
    capaLabel.setIcon(null);

    // limpa tabela book itens
    model.limpar();

    codigoCatalogoField.setEditable(true);
    codigoCatalogoField.requestFocus();
  }
 public static Map<String, Object> mensajeError(Exception e, String nombreClase) {
   JLabel jlMensaje =
       new JLabel(
           "<html>Lo sentimos, hemos detectado un error interno.<br/><br/>"
               + "<font size=5>¿Desea informar este problema?</font><br/><br/>"
               + "Se ha creado un informe de error que puede enviar para mejorar ShrimSoft.<br/>"
               + "Adicionalmente puede detallarnos sobre que provocó este error.</html>");
   JTextArea jtaMensaje = new JTextArea();
   jtaMensaje.setRows(6);
   jtaMensaje.setColumns(40);
   Object[] comp = {jlMensaje, jtaMensaje};
   Object[] botones = {"Enviar informe de error", "Cancelar"};
   int i =
       JOptionPane.showOptionDialog(
           null,
           comp,
           "ShrimSoft",
           JOptionPane.YES_NO_OPTION,
           JOptionPane.ERROR_MESSAGE,
           UIManager.getIcon("OptionPane.errorIcon"),
           botones,
           null);
   Map<String, Object> map = new HashMap<String, Object>();
   map.put("opcion", i);
   map.put("mensaje", jtaMensaje.getText());
   return map;
 }
Example #8
0
  /* Sjekker om scannet kort finnes og om det er gyldig,
  og skriver ut om scanningen var gyldig/ugyldig */
  private void sjekk() {
    vindu.getSelgerMetoder().setAktivTilKontroll();
    try {
      int nr = Integer.parseInt(kortid.getText());
      Boolean ok = aktivkortreg.sjekkGyldig(nr);
      if (ok) {
        info.setText("\n\n                       Gyldig");
        info.setBackground(Color.GREEN);
        if (scan(ok)) aktivkortreg.fjernKlipp(nr);

        kortid.setText("");
        kortid.selectAll();
        resetFocus();
      } else {
        info.setText("\n\n                    Ikke gyldig");
        info.setBackground(Color.RED);
        scan(ok);
        kortid.setText("");
        kortid.selectAll();
        resetFocus();
      }

      aktivkortreg.oppdater();
      vindu.oppdaterInfoPanel();
    } catch (NumberFormatException e) {
      info.setText("\n\n                    Kun tall...");
      kortid.setText("");
      timer.schedule(new Tick(), timersec * 500);
      return;
    }
  }
Example #9
0
 /** Set selection. */
 public void select() {
   pModel.findSelectionPositions();
   editor.setSelectedTextColor(Color.blue);
   editor.requestFocusInWindow();
   editor.setCaretPosition(pModel.getSelectionStart());
   editor.moveCaretPosition(pModel.getSelectionEnd());
 }
Example #10
0
 /* (非 Javadoc)
  * @see ifttt.module.Messenger#sendMessage(java.lang.String)
  */
 @Override
 public void sendMessage(String msg) {
   output.append(msg);
   if (msg.endsWith("\n") == false) {
     output.append("\n");
   }
 }
Example #11
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 #12
0
    public HttpClientFrame() {
      client = new HttpClient(new MultiThreadedHttpConnectionManager());
      client.getHttpConnectionManager().getParams().setConnectionTimeout(30000);

      JPanel panInput = new JPanel(new FlowLayout());

      String[] aURLs = {
        "http://www.apache.org/",
        "http://www.google.com/",
        "http://www.opensource.org/",
        "http://www.anybrowser.org/",
        "http://jakarta.apache.org/",
        "http://www.w3.org/"
      };

      final JButton btnGET = new JButton("GET");
      btnGET.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              String url = (String) cmbURL.getSelectedItem();
              if (url != null && url.length() > 0) {
                loadPage(url);
              }
            }
          });

      cmbURL = new JComboBox(aURLs);
      cmbURL.setToolTipText("Enter a URL");
      cmbURL.setEditable(true);
      cmbURL.setSelectedIndex(0);

      JLabel lblURL = new JLabel("URL:");

      panInput.add(lblURL);
      panInput.add(cmbURL);
      panInput.add(btnGET);

      taTextResponse = new JTextArea();
      taTextResponse.setEditable(false);
      taTextResponse.setCaretPosition(0);

      htmlPane = new JEditorPane();
      htmlPane.setContentType("text/html");
      htmlPane.setEditable(false);

      JSplitPane splitResponsePane =
          new JSplitPane(
              JSplitPane.HORIZONTAL_SPLIT,
              new JScrollPane(taTextResponse),
              new JScrollPane(htmlPane));
      splitResponsePane.setOneTouchExpandable(false);
      splitResponsePane.setDividerLocation(350);
      // it would be better to set resizeWeight, but this method does
      // not exist in JRE 1.2.2
      //            splitResponsePane.setResizeWeight(0.5);

      this.getContentPane().setLayout(new BorderLayout());
      this.getContentPane().add(panInput, BorderLayout.NORTH);
      this.getContentPane().add(splitResponsePane, BorderLayout.CENTER);
    }
Example #13
0
 private void readData() {
   String FileName;
   try {
     FileName =
         "BoBnCalData" + "/" + calYear + "_" + (calMonth + 1) + "_" + calDayOfMon + "" + ".txt";
     System.out.println(FileName);
     File f = new File(FileName);
     if (f.exists()) {
       BufferedReader in = new BufferedReader(new FileReader(FileName));
       String memoAreaText = new String();
       do {
         String tempStr = in.readLine();
         if (tempStr == null) break;
         memoAreaText =
             (new StringBuilder(String.valueOf(memoAreaText)))
                 .append(tempStr)
                 .append(System.getProperty("line.separator"))
                 .toString();
       } while (true);
       memoArea.setText(memoAreaText);
       in.close();
     } else {
       memoArea.setText("");
     }
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Example #14
0
 /** Saves the file back to disk. */
 private void saveFile() {
   File file = getTargetFile().getFile();
   Writer writer = null;
   Cursor originalcursor = this.getOwner().getCursor();
   this.getOwner().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   try {
     CharsetEncoder encoder = getCharset().newEncoder();
     if (encoder.canEncode(textArea.getText())) {
       writer = new OutputStreamWriter(new FileOutputStream(file), getCharset());
       textArea.write(writer);
       messageBox.clear();
     } else {
       findIllegalCharacter(encoder);
     }
   } catch (FileNotFoundException fnfx) {
     // happens also if file is RO
     logger.error("FileNotFoundException saving to " + file.getPath() + ": " + fnfx.getMessage());
     messageBox.error(getLocalizer().localize("message.file-removed"));
   } catch (IOException iox) {
     logger.error("IOException saving file " + file.getPath() + ": " + iox.getMessage());
     messageBox.error(
         getLocalizer()
             .localize("message.file-processing-error", new Object[] {iox.getMessage()}));
   } finally {
     this.getOwner().setCursor(originalcursor);
     if (writer != null)
       try {
         writer.close();
       } catch (IOException iox) {
         logger.warn("IOException closing stream: " + iox.getMessage());
       }
   }
 }
Example #15
0
  /**
   * Display a stack trace dialog. Eventually, the dialog should be able to email us a bug report.
   * The "info" argument is a string printed at the top of the dialog instead of the Exception
   * message.
   */
  public static void showStackTrace(Component parent, Exception e, String info) {
    // Show the stack trace in a scrollable text area.
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);

    JTextArea text = new JTextArea(sw.toString(), 60, 80);
    JScrollPane stext = new JScrollPane(text);
    stext.setPreferredSize(new Dimension(400, 200));
    text.setCaretPosition(0);
    text.setEditable(false);

    // We want to stack the text area with another message
    Object[] message = new Object[2];
    String string;

    if (info != null) {
      string = info + "\n" + e.getMessage();
    } else {
      string = e.getMessage();
    }

    message[0] = ellipsis(string, 400);
    message[1] = stext;

    // Show the MODAL dialog
    JOptionPane.showMessageDialog(parent, message, "Exception Caught", JOptionPane.WARNING_MESSAGE);
  }
  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 #17
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);
  }
Example #19
0
  public void initializeGUIComponents() {

    // Setup Data Panel
    editButton = new JButton("Edit");
    editButton.addActionListener(buttonController);
    JPanel buttonPanel = new JPanel();
    FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.RIGHT);
    buttonPanel.add(editButton);
    buttonPanel.add(Box.createHorizontalStrut(10));

    // Setup the Main Panel.
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Skills"));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    // Setup TextField
    scrollPane = new JScrollPane();
    taSkills = new JTextArea();
    taSkills.setLineWrap(true);
    taSkills.setWrapStyleWord(true);
    taSkills.setEditable(false);
    scrollPane.setViewportView(taSkills);

    add(scrollPane);
    add(buttonPanel);
  }
Example #20
0
  public void update() {
    welcomeLabel.setText("Welcome! You have " + credits + " credits.");

    if (game != null) {
      GameSquare gs = game.getGameSquareAt(leftClickRow, leftClickCol);
      if (game.getWinner() != -1) {
        gamePanel.add(returnToMenuButton);
        if (hasWon) gameInfo.setText("You won!");
        else gameInfo.setText("You lost.");
      } else if (gs.hasOccupant()) {
        Occupant o = gs.getOccupant();
        if (o instanceof Unit) {
          Unit u = (Unit) o;
          gameInfo.setText(u.getInfo());
        } else gameInfo.setText(o.toString());
        itemListModel.removeAllElements();
        if (o instanceof Unit) {
          List<Item> list = ((Unit) o).getItemList();
          for (Item i : list) {
            itemListModel.addElement(i);
          }
        }
      } else {
        gameInfo.setText("Empty");
      }

      boardPanel.repaint();
    }
  }
Example #21
0
  /** Exit if the user is not running a stable version */
  private static void checkVersion() {
    String versionText = wiki.getPageText(COMMONS_PAGE + "/MinimumVersion");
    if (versionText == null || versionText.equals("")) {
      exitWithWaring("Could not check for updates", "Update check failed");
    }

    String[] minVersion = versionText.substring(1).split("\\.", 3);

    // get int representation of three bytes
    int actualVersion = (VERSION_NUM[0] << 16) + (VERSION_NUM[1] << 8) + VERSION_NUM[2];
    int minimumVersion =
        (Byte.parseByte(minVersion[0]) << 16)
            + (Byte.parseByte(minVersion[1]) << 8)
            + Byte.parseByte(minVersion[2]);

    if (minimumVersion <= actualVersion) return;

    JTextArea msg =
        new JTextArea(
            "Current version: "
                + VERSION
                + "\n"
                + "Please update the program to version "
                + versionText
                + " or higher:"
                + "\n"
                + "https://github.com/Commonists/GlobalReplace/releases/latest"
                + "\nProgram will stop!");
    msg.setFocusable(true);
    exitWithWaring(msg, "Outdated version");
  }
  /*
   * Update radio button names in the same order as the table
   */
  private void updateControlPanel() {
    schedule.removeAll();
    noneButton.setName(""); // Name holds schedule id for the selected radio button
    noneButton.setSelected(true);
    commentTextArea.setText(""); // no text for the noneButton
    enableButtons(false);
    schedule.add(noneButton);
    schGroup.add(noneButton);

    for (int i = trainsScheduleModel.getFixedColumn();
        i < trainsScheduleModel.getColumnCount();
        i++) {
      log.debug("Column name: {}", trainsScheduleTable.getColumnName(i));
      TrainSchedule ts =
          trainScheduleManager.getScheduleByName(trainsScheduleTable.getColumnName(i));
      if (ts != null) {
        JRadioButton b = new JRadioButton();
        b.setText(ts.getName());
        b.setName(ts.getId());
        schedule.add(b);
        schGroup.add(b);
        addRadioButtonAction(b);
        if (b.getName().equals(trainManager.getTrainScheduleActiveId())) {
          b.setSelected(true);
          enableButtons(true);
          // update comment field
          commentTextArea.setText(ts.getComment());
        }
      }
    }
    schedule.revalidate();
  }
    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);
    }
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) {
        }
      }
    }
  }
Example #25
0
  /* Oppretter kontroll-vinduet, og GUI-elementer og timer.
  Database og Selgervindu kobles internt i klassen. */
  public KontrollVindu(String title, Database reg, SelgerVindu Svindu) {
    aktivkortreg = reg.getAktive();
    vindu = Svindu;
    open = vindu.getSelgerMetoder().getOpen();

    info = new JTextArea(6, 10);
    info.setEditable(false);
    info.setFont(new Font("Serif", Font.ROMAN_BASELINE, 20));
    kortid = new JTextField(15);
    kortid.addActionListener(this);
    sjekk = new JButton("Kontroller");
    sjekk.addActionListener(this);

    BorderLayout layout = new BorderLayout(5, 5);
    setLayout(layout);

    add(info, BorderLayout.PAGE_START);
    add(kortid, BorderLayout.CENTER);
    add(sjekk, BorderLayout.PAGE_END);

    setSize(300, 300);
    setVisible(true);

    timer = new Timer();
    wait = false;

    setOpen(open);

    resetFocus();
  }
Example #26
0
  private void themeing() {

    aboutDialogLogger.entry();
    Color color = new Color(0, 0, 0, 0);

    mainPanel.setOpaque(false);
    mainPanel.setBackground(new Color(51, 181, 229));

    programLabel.setFont(new Font(programLabel.getFont().getName(), Font.BOLD, 24));

    displayPanel.setOpaque(false);

    licenseScrollPane.setOpaque(false);
    licenseScrollPane.getViewport().setOpaque(false);
    licenseScrollPane.setBorder(null);
    licenseScrollPane.setViewportBorder(null);
    licenseTextArea.setOpaque(false);
    licenseTextArea.setBackground(color);
    licenseTextArea.setEditable(false);

    developerScrollPane.setOpaque(false);
    developerScrollPane.getViewport().setOpaque(false);
    developerScrollPane.setBorder(null);
    developerScrollPane.setViewportBorder(null);
    developerPane.setOpaque(false);
    developerPane.setBackground(color);
    developerPane.setEditable(false);
    emptyPanel.setOpaque(false);
    aboutDialogLogger.exit(LoggerValues.SUCCESSFUL_EXIT);
  }
Example #27
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 #28
-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();
    }
  }
Example #29
-1
  private void initComponents() {
    accountNumberField = new JTextFieldEx();
    accountCodeField = new JIntegerField();
    nameField = new JTextFieldEx();
    bankIdField = new JTextFieldEx();
    nameField.setText(rb.getString("Word.Name"));
    descriptionField = new JTextFieldEx();
    descriptionField.setText(rb.getString("Word.Description"));
    currencyCombo = new CurrencyComboBox();
    securityButton = new JButton(rb.getString("Word.None"));

    // for preferred width so button does not force a wide layout
    securityButton.setPreferredSize(new Dimension(20, securityButton.getPreferredSize().height));

    accountTypeModel = new DefaultComboBoxModel<>(AccountType.values());
    accountTypeModel.removeElement(AccountType.ROOT);
    accountTypeCombo = new JComboBox<>(accountTypeModel);

    lockedCheckBox = new JCheckBox(rb.getString("Button.Locked"));
    placeholderCheckBox = new JCheckBox(rb.getString("Button.PlaceHolder"));
    hideCheckBox = new JCheckBox(rb.getString("Button.HideAccount"));
    excludeBudgetCheckBox = new JCheckBox(rb.getString("Button.ExcludeFromBudget"));
    parentButton = new JButton("Root");

    notesArea = new javax.swing.JTextArea();
    notesArea.setLineWrap(true);
    notesArea.setAutoscrolls(false);
    notesArea.setPreferredSize(new java.awt.Dimension(100, 80));

    accountTypeCombo.addActionListener(this);
    securityButton.addActionListener(this);
    parentButton.addActionListener(this);
  }
Example #30
-1
 public JFrameComandi(Mediator mediator) {
   panelText = new JPanel();
   panelText.setLayout(new BorderLayout());
   panelText.setBackground(Color.white);
   panelButton = new JPanel();
   panelButton.setBackground(Color.white);
   dimensione = Toolkit.getDefaultToolkit().getScreenSize();
   setTitle("Comandi");
   txa = new JTextArea();
   txa.setEditable(false);
   txa.setText(text);
   txa.setFont(new Font("Ariel", Font.PLAIN, dimensione.height / 55));
   txa.setLineWrap(true);
   txa.setWrapStyleWord(true);
   ok = new JButton("ESCI");
   ok.setName("okComandi");
   ok.setFont(new Font("Ariel", Font.PLAIN, dimensione.height / 50));
   panelText.add(txa, BorderLayout.CENTER);
   panelButton.add(ok, BorderLayout.CENTER);
   mediator.manageEvent(new ActionEvent(ok, Counter.generateID(), null));
   pack();
   setResizable(false);
   setSize(new Dimension(dimensione.width / 3, dimensione.height / 3));
   add(panelText, BorderLayout.CENTER);
   add(panelButton, BorderLayout.SOUTH);
   setAlwaysOnTop(true);
   setLocationRelativeTo(null);
   setVisible(false);
   setDefaultCloseOperation(DISPOSE_ON_CLOSE);
 }