private void initGUI() {

    JPanel pCommand = new JPanel();

    pResult = new JPanel();
    nsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pCommand, pResult);

    pCommand.setLayout(new BorderLayout());
    pResult.setLayout(new BorderLayout());

    Font fFont = new Font("Dialog", Font.PLAIN, 12);

    txtCommand = new JTextArea(5, 40);

    txtCommand.setMargin(new Insets(5, 5, 5, 5));
    txtCommand.addKeyListener(this);

    txtCommandScroll = new JScrollPane(txtCommand);
    txtResult = new JTextArea(20, 40);

    txtResult.setMargin(new Insets(5, 5, 5, 5));

    txtResultScroll = new JScrollPane(txtResult);

    txtCommand.setFont(fFont);
    txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
    /*
    // button replaced by toolbar
            butExecute = new JButton("Execute");

            butExecute.addActionListener(this);
            pCommand.add(butExecute, BorderLayout.EAST);
    */
    pCommand.add(txtCommandScroll, BorderLayout.CENTER);

    gResult = new GridSwing();
    gResultTable = new JTable(gResult);
    gScrollPane = new JScrollPane(gResultTable);

    // getContentPane().setLayout(new BorderLayout());
    pResult.add(gScrollPane, BorderLayout.CENTER);

    // Set up the tree
    rootNode = new DefaultMutableTreeNode("Connection");
    treeModel = new DefaultTreeModel(rootNode);
    tTree = new JTree(treeModel);
    tScrollPane = new JScrollPane(tTree);

    tScrollPane.setPreferredSize(new Dimension(120, 400));
    tScrollPane.setMinimumSize(new Dimension(70, 100));
    txtCommandScroll.setPreferredSize(new Dimension(360, 100));
    txtCommandScroll.setMinimumSize(new Dimension(180, 100));
    gScrollPane.setPreferredSize(new Dimension(460, 300));

    ewSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tScrollPane, nsSplitPane);

    fMain.getContentPane().add(ewSplitPane, BorderLayout.CENTER);
    doLayout();
    fMain.pack();
  }
  /**
   * Create a new JumpSourcePanel.
   *
   * @param tab parent JumpTab
   */
  public JumpSourcePanel(final JumpTab tab) {
    this.tab = tab;
    this.editorPane = new JTextArea();
    this.highlighter = new DefaultHighlighter();
    highlighter.setDrawsLayeredHighlights(false);

    setLayout(new BorderLayout());
    setBorder(new TitledBorder("Source"));
    editorPane.setFont(JumpGui.FONT_MONOSPACED);
    editorPane.setHighlighter(highlighter);
    final StringBuilder sb = new StringBuilder();
    for (int i = 1; i < MAXIMUM_LINE_NUMBER; ++i) {
      sb.append(String.format("%3d %n", i));
    }

    final JTextArea lineNumbers = new JTextArea(sb.toString());
    lineNumbers.setFont(editorPane.getFont());
    lineNumbers.setBackground(getBackground());
    lineNumbers.setEditable(false);
    lineNumbers.setFocusable(false);

    final JScrollPane scrollPane =
        new JScrollPane(
            editorPane,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setRowHeaderView(lineNumbers);
    add(scrollPane);
    SwingUtilities.invokeLater(this);
  }
  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);
  }
Beispiel #4
0
 public void setSelectedFont(Font font) {
   selectedFont = font;
   family = font.getFamily();
   style = font.getStyle();
   size = font.getSize();
   preview.setFont(font);
 }
Beispiel #5
0
  public ChatServer() {
    getContentPane().setLayout(null);

    textArea.setBounds(10, 81, 287, 55);
    setBounds(290, 60, 310, 197);
    getContentPane().add(textArea);
    setTitle("SSTS Чат Сървър");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final JTextArea textArea_1 = new JTextArea();
    textArea_1.setFont(new Font("Monospaced", Font.PLAIN, 12));
    textArea_1.setText("8000");
    textArea_1.setBounds(10, 44, 169, 26);
    getContentPane().add(textArea_1);
    textArea.setEditable(false);

    JButton btnNewButton = new JButton("\u041F\u0443\u0441\u043D\u0438");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            LISTENING_PORT = Integer.parseInt(textArea_1.getText());
            serv = new Server();
            serv.start();
          }
        });
    btnNewButton.setBounds(189, 47, 89, 23);
    getContentPane().add(btnNewButton);

    JLabel label = new JLabel("\u041F\u043E\u0440\u0442");
    label.setFont(new Font("Tahoma", Font.BOLD, 14));
    label.setBounds(10, 19, 123, 26);
    getContentPane().add(label);
  }
  private void newComps() {
    ta = new JTextArea();
    // ta.setLineWrap(true);
    ta.setWrapStyleWord(true);
    ta.setFocusable(false);
    ta.setEditable(false);
    ta.setFont(new Font("Courier New", Font.BOLD, 20));
    ta.setBackground(Color.black);
    ta.setForeground(Color.GREEN);

    sc = new JScrollPane();
    sc.setViewportView(ta);

    btnExport = new JButton("Export");
    btnExport.setOpaque(false);
    btnExport.setFont(ta.getFont());
    btnExport.setFocusable(false);

    ckWrap = new JCheckBox("Wrap text");
    ckWrap.setOpaque(false);
    ckWrap.setForeground(Color.white);
    ckWrap.setFont(ta.getFont());
    ckWrap.setFocusable(false);

    chooser = new JFileChooser();
  }
Beispiel #7
0
  @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
      value = "DM_DEFAULT_ENCODING",
      justification = "Can only be called from the same instance so default encoding OK")
  private SystemConsole() {
    // Record current System.out and System.err
    // so that we can still send to them
    originalOut = System.out;
    originalErr = System.err;

    // Create the console text area
    console = new JTextArea();

    // Setup the console text area
    console.setRows(20);
    console.setColumns(120);
    console.setFont(new Font(fontFamily, fontStyle, fontSize));
    console.setEditable(false);
    setScheme(scheme);
    setWrapStyle(wrapStyle);

    this.outputStream = new PrintStream(outStream(STD_OUT), true);
    this.errorStream = new PrintStream(outStream(STD_ERR), true);

    // Then redirect to it
    redirectSystemStreams();
  }
  public TextPanel() {
    textArea = new JTextArea(2, 2);
    setLayout(new BorderLayout());

    textArea.setFont(new Font("ARIAL", Font.BOLD, 20));
    add(new JScrollPane(textArea), BorderLayout.CENTER);
  }
Beispiel #9
0
  public Console() {
    super("Javacalculus Test GUI");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    System.setOut(new PrintStream(new consoleOutputStream()));
    // System.setErr(new PrintStream(new consoleOutputStream(true)));
    inputLabel.setLabelFor(input);
    input.setPreferredSize(new Dimension(300, 20));
    input.setBorder(BorderFactory.createLoweredBevelBorder());
    input.addKeyListener(this);
    commandHistory.add("");
    execute.addActionListener(this);
    execute.setBackground(Color.GREEN);
    execute.setForeground(Color.WHITE);
    console.setLineWrap(true);
    console.setWrapStyleWord(true);
    console.setEditable(false);
    console.setFont(new Font("Dialog", Font.BOLD, 14));
    JScrollPane consolePane =
        new JScrollPane(
            console,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    consolePane.setPreferredSize(new Dimension(600, 300));
    consolePane.setBorder(BorderFactory.createLoweredBevelBorder());
    //		error.setLineWrap(true);
    //		error.setWrapStyleWord(true);
    //		error.setEditable(false);
    //    	error.setFont(new Font("Dialog", Font.ITALIC, 12));
    //		JScrollPane errorPane = new JScrollPane(error, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    //				JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    //		errorPane.setBorder(BorderFactory.createLoweredBevelBorder());
    //		errorPane.setPreferredSize(new Dimension(600,300));
    // content.setPreferredSize(new Dimension(400,400));
    content.setLayout(new GridBagLayout());
    content.setBorder(BorderFactory.createLoweredBevelBorder());
    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    content.add(inputLabel, c);
    c.gridx = 1;
    c.gridy = 0;
    content.add(input, c);
    c.gridx = 2;
    c.gridy = 0;
    content.add(execute, c);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 3;
    content.add(consolePane, c);
    //		c.gridx = 0; c.gridy = 2;
    //		content.add(errorPane, c);
    add(content);

    pack();
    setVisible(true);
    input.requestFocus();
  }
Beispiel #10
0
  /**
   * Erzeuge das Zusammenfassung-Panel, in dem die ausgewählten Verleihkarten im Detail angezeigt
   * werden.
   */
  private void erzeugeVerleihkartenAnzeiger() {
    JPanel verleihkartenAnzeigerPanel = new JPanel();
    BorderLayout detailsPanelLayout = new BorderLayout();
    _ruecknahmePanel.add(verleihkartenAnzeigerPanel, BorderLayout.CENTER);
    verleihkartenAnzeigerPanel.setLayout(detailsPanelLayout);
    verleihkartenAnzeigerPanel.setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAnzeigerPanel.setSize(-1, -1);
    verleihkartenAnzeigerPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    JScrollPane verleihkartenAnzeigerScrollPane = new JScrollPane();
    verleihkartenAnzeigerPanel.add(verleihkartenAnzeigerScrollPane, BorderLayout.CENTER);
    verleihkartenAnzeigerScrollPane.setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAnzeigerScrollPane.setBorder(
        BorderFactory.createTitledBorder(
            null,
            "Ausgewählte Verleihkarten",
            TitledBorder.LEADING,
            TitledBorder.DEFAULT_POSITION,
            UIConstants.HEADER_FONT));
    verleihkartenAnzeigerScrollPane.setSize(-1, -1);
    verleihkartenAnzeigerScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane
        .getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane
        .getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _verleihkartenAnzeigerTextArea = new JTextArea();
    _verleihkartenAnzeigerTextArea.setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAnzeigerScrollPane.setViewportView(_verleihkartenAnzeigerTextArea);
    _verleihkartenAnzeigerTextArea.setEditable(false);
    _verleihkartenAnzeigerTextArea.setFont(UIConstants.TEXT_FONT);
  }
Beispiel #11
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();
  }
  @Override
  public JFrame createWindow(JGamePanel gamePanel) {
    // Initialize layout components
    JPanel mainPanel = new JPanel();
    SpringLayout layout = new SpringLayout();
    mainPanel.setLayout(layout);

    // Initialize each component
    JFrame window = new JFrame();
    mainPanel.add(gamePanel);
    JTextArea logArea = new JTextArea();
    JScrollPane logScrollPane = new JScrollPane(logArea);
    logScrollPane.setPreferredSize(new Dimension(0, 0));
    mainPanel.add(logScrollPane);
    logArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    logArea.setEditable(false);
    JTextField commandField = new JTextField();
    commandField.setPreferredSize(new Dimension(0, 20));
    commandField.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    mainPanel.add(commandField);

    // Layout compo6nents
    layout.putConstraint(SpringLayout.NORTH, gamePanel, 0, SpringLayout.NORTH, mainPanel);
    layout.putConstraint(SpringLayout.NORTH, logScrollPane, 0, SpringLayout.SOUTH, gamePanel);
    layout.putConstraint(SpringLayout.SOUTH, logScrollPane, 0, SpringLayout.NORTH, commandField);
    layout.putConstraint(SpringLayout.SOUTH, commandField, 0, SpringLayout.SOUTH, mainPanel);
    layout.putConstraint(SpringLayout.WEST, logScrollPane, 0, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.WEST, commandField, 0, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.EAST, logScrollPane, 0, SpringLayout.EAST, mainPanel);
    layout.putConstraint(SpringLayout.EAST, commandField, 0, SpringLayout.EAST, mainPanel);

    window.getContentPane().add(mainPanel);
    return window;
  }
Beispiel #13
0
  public ReplyView(MikroEventModel e, EventViewManager m) {
    super();
    evm = m;
    textArea = new JTextArea("@" + evm.event.getAuthor() + " ", 4, 45);
    Font f = new Font("Nimbus Sans L Bold", Font.PLAIN, 15);
    textArea.setFont(f);
    textArea.setLineWrap(true);
    ((AbstractDocument) textArea.getDocument()).setDocumentFilter(new DocumentSizeFilter(140));
    buttonPanel = new JPanel();
    submitButton = new JButton("Post");
    cancelButton = new JButton("Cancel");

    submitButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            evm.reply(textArea.getText());
          }
        });
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            evm.setEventView();
          }
        });

    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
    buttonPanel.add(Box.createHorizontalGlue());
    buttonPanel.add(submitButton);
    buttonPanel.add(Box.createHorizontalStrut(5));
    buttonPanel.add(cancelButton);

    this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    this.add(textArea);
    this.add(buttonPanel);
  }
 private void addInfoPanel(
     Icon icon, String titleString, String textString, JButton... buttons) {
   JLabel regenerateIcon = new JLabel(icon);
   JLabel title = new JLabel(titleString, SwingConstants.LEFT);
   title.setFont(FlexoCst.BOLD_FONT);
   JTextArea text = new JTextArea(textString);
   text.setBackground(null);
   text.setEditable(false);
   text.setFont(FlexoCst.NORMAL_FONT);
   text.setLineWrap(true);
   text.setWrapStyleWord(true);
   text.setBorder(BorderFactory.createEmptyBorder(0, 30, 10, 30));
   JPanel infoPanel = new JPanel(new VerticalLayout());
   JPanel titlePanel = new JPanel(new FlowLayout());
   titlePanel.add(regenerateIcon);
   titlePanel.add(title);
   infoPanel.add(titlePanel);
   infoPanel.add(text);
   if (buttons != null && buttons.length > 0) {
     JPanel buttonPanel = new JPanel(new FlowLayout());
     for (JButton b : buttons) {
       buttonPanel.add(b);
     }
     infoPanel.add(buttonPanel);
   }
   add(infoPanel, BorderLayout.SOUTH);
 }
Beispiel #15
0
  private void setAllFonts() {

    Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
    Font fontBold = new Font(Font.SANS_SERIF, Font.BOLD, 12);
    Font fontSmallItalic = new Font(Font.SANS_SERIF, Font.ITALIC, 10);

    lb_smtp.setFont(fontBold);
    tf_smtp.setFont(font);
    lb_smtpUser.setFont(fontBold);
    tf_smtpUser.setFont(font);
    lb_smtpPW.setFont(fontBold);
    pf_smtpPW.setFont(font);
    lb_from.setFont(fontBold);
    tf_from.setFont(font);
    lb_to.setFont(fontBold);
    tf_to.setFont(font);
    lb_cc.setFont(fontBold);
    tf_cc.setFont(font);
    lb_bcc.setFont(fontBold);
    tf_bcc.setFont(font);
    lb_subject.setFont(fontBold);
    tf_subject.setFont(font);
    ta_text.setFont(font);
    cb_attachXml.setFont(fontBold);
    cb_attachGif.setFont(fontBold);
    cb_attachPdf.setFont(fontBold);
    lnk_smtpInfo.setFont(fontSmallItalic);
    cb_smtp_auth.setFont(fontSmallItalic);
    cb_pwSave.setFont(fontSmallItalic);
  }
Beispiel #16
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();
      }
    }
  public PrinterStatusPanel(Executor exe) {
    this.exe = exe;
    myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.PAGE_AXIS));
    myPanel.setBorder(
        BorderFactory.createTitledBorder(
            BorderFactory.createLineBorder(Color.black), "Printer Status"));

    // Temperature plot
    tempPanel = new TemperaturePanel(exe);

    // Text Area for Log Messages
    statusText.setEditable(false);
    statusText.setFont(new Font(Font.MONOSPACED, Font.PLAIN, FONT_SIZE));
    statusText.setLineWrap(false);
    statusText.setText(OFFLINE_MESSAGE);
    final DefaultCaret caret = (DefaultCaret) statusText.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    scrollPane = new JScrollPane(statusText);
    scrollPane.setViewportView(statusText);

    final JSplitPane splitPane =
        new JSplitPane(JSplitPane.VERTICAL_SPLIT, tempPanel.getPanel(), scrollPane);
    splitPane.setDividerLocation(300);
    myPanel.add(splitPane);
    GuiAppender.setTextArea(statusText);
  }
Beispiel #18
0
  public BarUI(BarCntl theBarCntl) {
    this.theBarCntl = theBarCntl;
    this.newBar = new Bar();
    this.setSize(400, 300);
    this.setLocationRelativeTo(null);
    this.setResizable(false);
    this.setLayout(new BorderLayout());
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    topPanel = new JPanel();
    centerPanel = new JPanel();

    back = new JButton("< Back");
    back.setBounds(50, 50, 100, 50);
    back.addActionListener(this);
    topPanel.add(back);

    getBar = new JButton("Get Bar");
    getBar.setBounds(50, 50, 100, 50);
    getBar.addActionListener(this);
    topPanel.add(getBar);

    displayBar = new JTextArea("Press 'Get Bar'");
    displayBar.setMargin(new Insets(20, 20, 20, 50));
    displayBar.setFont(displayBar.getFont().deriveFont(18.0f));
    displayBar.setEditable(false);
    centerPanel.add(displayBar);

    this.add(topPanel, BorderLayout.NORTH);
    this.add(centerPanel, BorderLayout.CENTER);
  }
  /**
   * Creates a new DirectTextEditorPanel.<br>
   * Sets a BorderLayout as the layout manager.
   *
   * @param mainFrame reference to the main frame
   */
  public DirectTextEditorPanel(final MainFrame mainFrame) {
    super(mainFrame, "Direct editing", new BorderLayout());

    policyTextTextArea.setFont(Consts.DIRECT_EDITING_FONT);
    policyTextTextArea.setTabSize(Consts.DIRECT_EDITING_TAB_SIZE);

    // We want to track changes of the document so we can ask confirmation on exit
    policyTextTextArea
        .getDocument()
        .addDocumentListener(
            new DocumentListener() {
              public void changedUpdate(final DocumentEvent de) {}

              public void insertUpdate(final DocumentEvent de) {
                setHasDirty(true);
              }

              public void removeUpdate(final DocumentEvent de) {
                setHasDirty(true);
              }
            });

    add(
        new JScrollPane(
            policyTextTextArea,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS),
        BorderLayout.CENTER);
  }
Beispiel #20
0
 public ConsolePanel() {
   super(new BorderLayout());
   text.setFont(StyleContext.getDefaultStyleContext().getFont("SansSerif", Font.PLAIN, 10));
   JScrollPane scroller = new JScrollPane(text);
   scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
   add(BorderLayout.CENTER, scroller);
 }
Beispiel #21
0
  /**
   * Get the {@link JComponent} that displays the given message.
   *
   * @param msg Message to display.
   * @param breakLines Whether or not {@literal "long"} lines should be broken up.
   * @return {@code JComponent} that displays {@code msg}.
   */
  private static JComponent getMessageComponent(String msg, boolean breakLines) {
    if (msg.startsWith("<html>")) {
      Component[] comps = GuiUtils.getHtmlComponent(msg, null, 500, 400);
      return (JScrollPane) comps[1];
    }

    int msgLength = msg.length();
    if (msgLength < 50) {
      return new JLabel(msg);
    }

    StringBuilder sb = new StringBuilder(msgLength * 2);
    if (breakLines) {
      for (String line : StringUtil.split(msg, "\n")) {
        line = StringUtil.breakText(line, "\n", 50);
        sb.append(line).append('\n');
      }
    } else {
      sb.append(msg).append('\n');
    }

    JTextArea textArea = new JTextArea(sb.toString());
    textArea.setFont(textArea.getFont().deriveFont(Font.BOLD));
    textArea.setBackground(new JPanel().getBackground());
    textArea.setEditable(false);
    JScrollPane textSp = GuiUtils.makeScrollPane(textArea, 400, 200);
    textSp.setPreferredSize(new Dimension(400, 200));
    return textSp;
  }
  private void initialize() {
    frmServer = new JFrame();
    frmServer.setResizable(false);
    frmServer.setTitle("Server");
    frmServer.setBounds(100, 100, 234, 262);
    frmServer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmServer.getContentPane().setLayout(null);

    labelTemperature = new JLabel("0" + CELCIUS);
    labelTemperature.setHorizontalAlignment(SwingConstants.CENTER);
    labelTemperature.setFont(new Font("Tahoma", Font.PLAIN, 60));
    labelTemperature.setBounds(10, 57, 208, 56);
    frmServer.getContentPane().add(labelTemperature);

    JLabel lblServer = new JLabel("Server");
    lblServer.setFont(new Font("Tahoma", Font.PLAIN, 40));
    lblServer.setHorizontalAlignment(SwingConstants.CENTER);
    lblServer.setBounds(26, 11, 176, 49);
    frmServer.getContentPane().add(lblServer);

    textLog = new JTextArea();
    textLog.setFont(new Font("Tahoma", Font.PLAIN, 9));
    textLog.setBounds(10, 124, 208, 99);
    frmServer.getContentPane().add(textLog);
  }
Beispiel #23
0
 private JComponent buildTextArea() {
   jtextArea = new JTextArea(handlerGui.getLogRecords());
   jtextArea.setEditable(false);
   jtextArea.setFont(new Font(fontFamilyTextArea, Font.PLAIN, 12));
   jtextArea.setLineWrap(false);
   jtextArea.setTabSize(4);
   return jtextArea;
 }
Beispiel #24
0
 public JTextArea getTxtEntrada() {
   if (txtEntrada == null) {
     txtEntrada = new JTextArea();
     txtEntrada.setLineWrap(true);
     txtEntrada.setFont(new Font("Consolas", Font.PLAIN, 13));
   }
   return txtEntrada;
 }
Beispiel #25
0
  public static JTextArea getTextArea() {
    JTextArea component = new JTextArea();
    component.setBackground(BACKGROUND_COLOR_TXTA);
    component.setForeground(TEXT_COLOR_TXTA);
    component.setFont(FONT_TYPE_TXTA);

    return component;
  }
  public void go() {
    // build gui

    frame = new JFrame("Quiz Card Buider");
    JPanel mainPanel = new JPanel();
    Font bigFont = new Font("sanserif", Font.BOLD, 24);
    question = new JTextArea(6, 20);
    question.setLineWrap(true);
    question.setWrapStyleWord(true);
    question.setFont(bigFont);

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

    answer = new JTextArea(6, 20);
    answer.setLineWrap(true);
    answer.setWrapStyleWord(true);
    answer.setFont(bigFont);

    JScrollPane aScroller = new JScrollPane(question);
    aScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    aScroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    JButton nextButton = new JButton("Next Card");

    cardList = new ArrayList<QuizCard>();

    JLabel qLabel = new JLabel("Question");
    JLabel aLabel = new JLabel("Answer");

    mainPanel.add(qLabel);
    mainPanel.add(qScroller);
    mainPanel.add(aLabel);
    mainPanel.add(aScroller);
    mainPanel.add(nextButton);

    nextButton.addActionListener(new NextCardListener());

    JMenuBar menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu("File");

    JMenuItem newMenuItem = new JMenuItem("New");
    JMenuItem saveMenuItem = new JMenuItem("Save");
    newMenuItem.addActionListener(new NewMenuListener());
    saveMenuItem.addActionListener(new SaveMenuListener());

    fileMenu.add(newMenuItem);
    fileMenu.add(saveMenuItem);
    menuBar.add(fileMenu);
    frame.setJMenuBar(menuBar);
    frame.getContentPane().add(BorderLayout.CENTER, mainPanel);
    frame.setSize(500, 600);
    frame.setVisible(true);
    // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

  }
Beispiel #27
-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);
 }
Beispiel #28
-1
  /**
   * Create the panel.
   *
   * @param notifyInterface the object to notify when the user submits entered text; if null, text
   *     entry is disallowed.
   */
  public ChatArea(ChatAreaNotifyInterface notifyInterface) {
    this.mainWindow = notifyInterface;

    setLayout(new BorderLayout(0, 0));
    setBorder(new EmptyBorder(0, 0, 0, 0));

    textField = new JTextField();
    add(textField, BorderLayout.SOUTH);

    if (this.mainWindow == null) {
      textField.setEnabled(false);
    } else {
      textField.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              textAreaAction(e);
            }
          });
    }

    textArea = new JTextArea();
    textArea.setRequestFocusEnabled(false);
    textArea.setFont(new Font("Monospaced", Font.PLAIN, 12));
    textArea.setText("");
    textArea.setBorder(null);
    textArea.setEditable(false);
    textArea.setLineWrap(true);
    caret = (DefaultCaret) textArea.getCaret();
    textAreaScrollPane = new JScrollPane(textArea);
    textAreaScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    textAreaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    textAreaScrollPane.setBorder(null);
    add(textAreaScrollPane, BorderLayout.CENTER);
  }
  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);
  }
  public BaseGoogleLoginUI(@NotNull String signinText) {
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(MIN_WIDTH, PREFERRED_HEIGHT));
    setOpaque(false);

    JLabel googleIcon = new JBLabel();

    setBorder(BorderFactory.createEmptyBorder(10, 15, 15, 15));
    googleIcon.setHorizontalAlignment(SwingConstants.CENTER);
    googleIcon.setVerticalAlignment(SwingConstants.CENTER);
    googleIcon.setOpaque(false);
    googleIcon.setIcon(GoogleLoginIcons.GOOGLE_LOGO);
    googleIcon.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weighty = 0;
    add(googleIcon, c);

    JTextArea signinTextArea = new JTextArea();
    signinTextArea.setFont(UIUtil.getLabelFont());
    signinTextArea.setLineWrap(true);
    signinTextArea.setWrapStyleWord(true);
    signinTextArea.setOpaque(false);
    signinTextArea.setText(signinText);
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.CENTER;
    add(signinTextArea, c);
  }