예제 #1
0
  public JPanel demo(Graph g, final String label) {
    // create a new radial tree view
    final PhysioMapRadialGraphView gview =
        new PhysioMapRadialGraphView(settings, g, label, semsimmodel);
    Visualization vis = gview.getVisualization();

    // create a search panel for the tree map
    SearchQueryBinding sq =
        new SearchQueryBinding(
            (Table) vis.getGroup(treeNodes),
            label,
            (SearchTupleSet) vis.getGroup(Visualization.SEARCH_ITEMS));
    JSearchPanel search = sq.createSearchPanel();
    search.setShowResultCount(true);
    search.setBorder(BorderFactory.createEmptyBorder(5, 5, 4, 0));
    search.setFont(FontLib.getFont("Verdana", Font.PLAIN, 11));

    final JTextArea title = new JTextArea();
    title.setPreferredSize(new Dimension(450, 500));
    title.setMaximumSize(new Dimension(450, 500));
    title.setMinimumSize(new Dimension(450, 500));

    title.setAlignmentY(CENTER_ALIGNMENT);
    title.setLineWrap(true);
    title.setWrapStyleWord(true);
    title.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
    title.setFont(FontLib.getFont("Verdana", Font.PLAIN, 11));

    gview.addControlListener(
        new ControlAdapter() {
          public void itemEntered(VisualItem item, MouseEvent e) {}

          public void itemExited(VisualItem item, MouseEvent e) {
            title.setText(null);
          }
        });

    Box searchbox = new Box(BoxLayout.X_AXIS);
    searchbox.add(Box.createHorizontalStrut(10));
    searchbox.add(search);
    searchbox.add(Box.createHorizontalStrut(3));

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(searchbox, BorderLayout.NORTH);
    panel.add(gview, BorderLayout.CENTER);
    panel.add(Box.createGlue(), BorderLayout.SOUTH);

    Color BACKGROUND = Color.WHITE;
    Color FOREGROUND = Color.DARK_GRAY;
    UILib.setColor(panel, BACKGROUND, FOREGROUND);

    return panel;
  }
예제 #2
0
 /** Create and add Clippy's output text */
 public void addClippyTxt() {
   clippyTxt.setLineWrap(true);
   clippyTxt.setWrapStyleWord(true);
   clippyTxt.setEditable(false);
   clippyTxt.setFont(txtFont);
   clippyTxt.setAlignmentX(JTextArea.CENTER_ALIGNMENT);
   clippyTxt.setAlignmentY(JTextArea.CENTER_ALIGNMENT);
   clippyTxt.setBorder(null);
   clippyTxt.setSize(105, 35);
   clippyTxt.setLocation(25, 45);
   clippyTxt.setOpaque(false);
   lpane.add(clippyTxt, new Integer(1), 0);
 }
예제 #3
0
  public MomentCellContent() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    MomTextArea = new JTextArea("this is my first moment!");
    MomTextArea.setLineWrap(true);
    // MomTextArea.setBackground(new Color(220, 220, 220));
    MomTextArea.setWrapStyleWord(true);
    MomTextArea.setAlignmentY(0.0f);
    MomTextArea.setEditable(false);
    MomTextArea.setOpaque(false);
    // MomTextArea.setPreferredSize(new Dimension(400, 100));
    MomTextArea.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(MomTextArea);
    add(lblPic);
  }
예제 #4
0
  // Конструктор класса
  public Log() {
    text = new JTextArea(); // Добавляем текст на панель
    text.setAlignmentX(LEFT_ALIGNMENT); // Позиционируем её налево
    text.setAlignmentY(TOP_ALIGNMENT); // и прижимаем к верху
    text.setBackground(Color.BLACK); // Задний фон - чёрный
    text.setForeground(Color.WHITE); // Цвет текста - белый
    text.setFont(References.LOG_FONT); // Стиль шрифта из файла References
    text.setLineWrap(true); // Устанавливаем перенос строк
    text.setWrapStyleWord(true); // И слов

    JScrollPane scrollPane = new JScrollPane(text); // Создаём ScrollBar
    scrollPane.setPreferredSize(new Dimension(500, 200)); // Ограничиваем размеры области вывода
    this.add(scrollPane); // Добавляем к нашей импровизированной консоли
    this.setVisible(true); // Отрисовываем
  }
  public TextPanel(TextEditor ne, PDWorkingCopy workingCopy, GUID id) {
    super(new BorderLayout());
    editor = ne;
    store = workingCopy;
    history = PDHistory.load(store, id);
    new Dimension(100, 100);

    // int w = getWidth();
    // int h = getHeight();
    // new Point(w / 2, h / 2);

    textArea = new JTextArea();
    textArea.setAlignmentX(LEFT_ALIGNMENT);
    textArea.setAlignmentY(TOP_ALIGNMENT);

    this.add(textArea);

    textArea.addKeyListener(this);
  }
예제 #6
0
파일: JChat.java 프로젝트: ThatoP/JChat
  public JChat() {
    this.setSize(500, 600);
    this.setResizable(false);
    this.setLayout(new BorderLayout());

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new GridLayout(2, 1));

    // set up buttons
    openChat = new JButton("Open to chat");
    openChat.addActionListener(new OpenChat());
    chatWith = new JButton("Chat with");
    chatWith.addActionListener(new ChatWith());
    send = new JButton("send");
    send.addActionListener(new Send());
    send.setEnabled(false);
    InputMap inputMap = send.getInputMap(JButton.WHEN_IN_FOCUSED_WINDOW);
    KeyStroke enter = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
    inputMap.put(enter, "ENTER");
    send.getActionMap().put("ENTER", new ClickAction(send));

    // set up labels
    pickPort = new JLabel();
    pickPort.setText("Pick your port number:");
    desPort = new JLabel();
    desPort.setText("Or enter a destinaltion port number:");

    // set up text fields
    pickText = new JTextField();
    pickText.setPreferredSize(new Dimension(150, 30));
    desText = new JTextField();
    desText.setPreferredSize(new Dimension(150, 30));
    chatText = new JTextField();
    chatText.setPreferredSize(new Dimension(400, 30));
    chatText.setEnabled(false);

    JPanel top1 = new JPanel();
    top1.add(pickPort);
    top1.add(pickText);
    top1.add(openChat);

    JPanel top2 = new JPanel();
    top2.add(desPort);
    top2.add(desText);
    top2.add(chatWith);

    topPanel.add(top1);
    topPanel.add(top2);

    chatField = new JTextArea();
    chatField.setAutoscrolls(true);
    chatField.setDragEnabled(true);
    chatField.setEditable(false);
    chatField.setAlignmentY(TOP_ALIGNMENT);

    JPanel bottomPanel = new JPanel();
    bottomPanel.add(chatText);
    bottomPanel.add(send);

    this.add(topPanel, BorderLayout.NORTH);
    this.add(chatField, BorderLayout.CENTER);
    this.add(bottomPanel, BorderLayout.SOUTH);

    this.setVisible(true);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }