示例#1
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);
 }
示例#2
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);
  }
示例#3
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 GAPConnectDialog(Frame frame) {
   super(frame, "网络连接", false);
   try {
     UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
   } catch (ClassNotFoundException e) {
     // TODO 自动生成的 catch 块
     e.printStackTrace();
   } catch (InstantiationException e) {
     // TODO 自动生成的 catch 块
     e.printStackTrace();
   } catch (IllegalAccessException e) {
     // TODO 自动生成的 catch 块
     e.printStackTrace();
   } catch (UnsupportedLookAndFeelException e) {
     // TODO 自动生成的 catch 块
     e.printStackTrace();
   }
   this.frame = frame;
   textArea = new JTextArea();
   textArea.setBackground(Color.white);
   textArea.setLineWrap(true);
   textArea.setEditable(false);
   textArea.setFont(ComponentStyle.defaultFont);
   textArea.setAlignmentX(0.5f);
   textArea.setBorder(BorderFactory.createEmptyBorder());
   jspane = new JScrollPane(textArea);
   jsbar = jspane.getVerticalScrollBar();
   cancel = new GAPButton("取消");
   cancel.setFont(ComponentStyle.defaultFont);
   reconnect = new GAPButton("重新连接");
   reconnect.setFont(ComponentStyle.defaultFont);
   confirm = new GAPButton("确定");
   confirm.setFont(ComponentStyle.defaultFont);
   cancelConnect = new GAPButton("取消连接");
   cancelConnect.setFont(ComponentStyle.defaultFont);
   JPanel jp = new JPanel();
   jp.setBackground(Color.white);
   jp.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 5));
   jp.add(reconnect);
   jp.add(confirm);
   jp.add(cancel);
   add(jspane, BorderLayout.CENTER);
   add(jp, BorderLayout.SOUTH);
   setLocationRelativeTo(frame);
   setSize(WIDTH, HEIGHT);
 }
  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
  private void setButtons(JPanel bp) {
    bp.setLayout(new BoxLayout(bp, BoxLayout.Y_AXIS));
    JButton addRowButton = new JButton("Add Row");
    addRowButton.addActionListener(new addRowListener());
    addRowButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    JButton addColumnButton = new JButton("Add Column");
    addColumnButton.addActionListener(new addColListener());
    addColumnButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    JButton deleteColumnButton = new JButton("Delete Column(s)");
    deleteColumnButton.addActionListener(new deleteColListener());
    deleteColumnButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    JButton doneButton = new JButton("Done");
    doneButton.addActionListener(new doneListener());
    doneButton.setAlignmentX(Component.LEFT_ALIGNMENT);
    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new cancelListener());
    cancelButton.setAlignmentX(Component.LEFT_ALIGNMENT);

    JTextArea info =
        new JTextArea(
            "Each column represents one type of annotation.\n\n"
                + "If you want to have a pull-down list of allowable entries\n"
                + "then place allowable values in the rows\n"
                + "otherwise leave blank and a text entry field will be presented\n");
    info.setEditable(false);
    info.setAlignmentX(Component.LEFT_ALIGNMENT);

    bp.add(info);
    bp.add(addRowButton);

    JPanel addColPanel = new JPanel();
    addColPanel.add(addColumnButton);
    colNameField = new JTextField("New column name", 20);
    addColPanel.add(colNameField);
    addColPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    bp.add(addColPanel);
    bp.add(deleteColumnButton);
    bp.add(doneButton);
    bp.add(cancelButton);
  }
  /** Constructs the <tt>LoginWindow</tt>. */
  private void init() {
    String title;

    if (windowTitle != null) title = windowTitle;
    else
      title =
          DesktopUtilActivator.getResources()
              .getI18NString("service.gui.AUTHENTICATION_WINDOW_TITLE", new String[] {server});

    String text;
    if (windowText != null) text = windowText;
    else
      text =
          DesktopUtilActivator.getResources()
              .getI18NString("service.gui.AUTHENTICATION_REQUESTED_SERVER", new String[] {server});

    String uinText;
    if (usernameLabelText != null) uinText = usernameLabelText;
    else uinText = DesktopUtilActivator.getResources().getI18NString("service.gui.IDENTIFIER");

    String passText;
    if (passwordLabelText != null) passText = passwordLabelText;
    else passText = DesktopUtilActivator.getResources().getI18NString("service.gui.PASSWORD");

    setTitle(title);

    infoTextArea.setEditable(false);
    infoTextArea.setOpaque(false);
    infoTextArea.setLineWrap(true);
    infoTextArea.setWrapStyleWord(true);
    infoTextArea.setFont(infoTextArea.getFont().deriveFont(Font.BOLD));
    infoTextArea.setText(text);
    infoTextArea.setAlignmentX(0.5f);

    JLabel uinLabel = new JLabel(uinText);
    uinLabel.setFont(uinLabel.getFont().deriveFont(Font.BOLD));

    JLabel passwdLabel = new JLabel(passText);
    passwdLabel.setFont(passwdLabel.getFont().deriveFont(Font.BOLD));

    TransparentPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1, 8, 8));

    labelsPanel.add(uinLabel);
    labelsPanel.add(passwdLabel);

    TransparentPanel textFieldsPanel = new TransparentPanel(new GridLayout(0, 1, 8, 8));

    textFieldsPanel.add(uinValue);
    textFieldsPanel.add(passwdField);

    JPanel southFieldsPanel = new TransparentPanel(new GridLayout(1, 2));

    this.rememberPassCheckBox.setOpaque(false);
    this.rememberPassCheckBox.setBorder(null);

    southFieldsPanel.add(rememberPassCheckBox);
    if (signupLink != null && signupLink.length() > 0)
      southFieldsPanel.add(
          createWebSignupLabel(
              DesktopUtilActivator.getResources().getI18NString("plugin.simpleaccregwizz.SIGNUP"),
              signupLink));
    else southFieldsPanel.add(new JLabel());

    boolean allowRememberPassword = true;

    String allowRemPassStr =
        DesktopUtilActivator.getResources().getSettingsString(PNAME_ALLOW_SAVE_PASSWORD);
    if (allowRemPassStr != null) {
      allowRememberPassword = Boolean.parseBoolean(allowRemPassStr);
    }
    allowRememberPassword =
        DesktopUtilActivator.getConfigurationService()
            .getBoolean(PNAME_ALLOW_SAVE_PASSWORD, allowRememberPassword);

    setAllowSavePassword(allowRememberPassword);

    JPanel buttonPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));

    buttonPanel.add(loginButton);
    buttonPanel.add(cancelButton);

    JPanel southEastPanel = new TransparentPanel(new BorderLayout());
    southEastPanel.add(buttonPanel, BorderLayout.EAST);

    TransparentPanel mainPanel = new TransparentPanel(new BorderLayout(10, 10));

    mainPanel.setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 20));

    JPanel mainFieldsPanel = new TransparentPanel(new BorderLayout(0, 10));
    mainFieldsPanel.add(labelsPanel, BorderLayout.WEST);
    mainFieldsPanel.add(textFieldsPanel, BorderLayout.CENTER);
    mainFieldsPanel.add(southFieldsPanel, BorderLayout.SOUTH);

    mainPanel.add(infoTextArea, BorderLayout.NORTH);
    mainPanel.add(mainFieldsPanel, BorderLayout.CENTER);
    mainPanel.add(southEastPanel, BorderLayout.SOUTH);

    this.getContentPane().add(mainPanel, BorderLayout.EAST);

    this.loginButton.setName("ok");
    this.cancelButton.setName("cancel");
    if (loginButton.getPreferredSize().width > cancelButton.getPreferredSize().width)
      cancelButton.setPreferredSize(loginButton.getPreferredSize());
    else loginButton.setPreferredSize(cancelButton.getPreferredSize());

    this.loginButton.setMnemonic(
        DesktopUtilActivator.getResources().getI18nMnemonic("service.gui.OK"));
    this.cancelButton.setMnemonic(
        DesktopUtilActivator.getResources().getI18nMnemonic("service.gui.CANCEL"));

    this.loginButton.addActionListener(this);
    this.cancelButton.addActionListener(this);

    this.getRootPane().setDefaultButton(loginButton);
  }