Exemplo n.º 1
0
 public HeaderPanel(String heading) {
   super();
   this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
   this.setBackground(background);
   JLabel panelLabel = new JLabel(" " + heading, SwingConstants.LEFT);
   Font labelFont = new Font("Dialog", Font.BOLD, 18);
   panelLabel.setFont(labelFont);
   this.add(panelLabel);
   this.add(Box.createHorizontalGlue());
   refresh = new JButton("Refresh");
   refresh.addActionListener(this);
   this.add(refresh);
   this.add(Box.createHorizontalStrut(5));
   root = new JComboBox();
   Dimension d = root.getPreferredSize();
   d.width = 90;
   root.setPreferredSize(d);
   root.setMaximumSize(d);
   File[] roots = directoryPane.getRoots();
   for (int i = 0; i < roots.length; i++) root.addItem(roots[i].getAbsolutePath());
   this.add(root);
   root.setSelectedIndex(directoryPane.getCurrentRootIndex());
   root.addActionListener(this);
   this.add(Box.createHorizontalStrut(17));
 }
Exemplo n.º 2
0
 public ReferencePropertyWidget(boolean containedByListReferenceGUI) {
   this.containedByListReferenceGUI = containedByListReferenceGUI;
   // get Options
   m_comboBox = new JComboBox();
   m_comboBox.setEditable(false);
   m_comboBox.setPreferredSize(new Dimension(300, 20));
   // m_comboBox.setMinimumSize(new Dimension(260, 20));
   m_comboBox.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));
   KeyStroke controlT = KeyStroke.getKeyStroke("control SPACE");
   getTextField().getInputMap().put(controlT, controlT);
   getTextField().getActionMap().put(controlT, new CodeCompleteAction());
   ToolTipManager.sharedInstance().registerComponent(m_comboBox);
 }
Exemplo n.º 3
0
 // 构造器,用于初始化的登录对话框
 public LoginFrame(LanTalk parent, String msg) {
   super(parent, "输入名字后登录", true);
   this.chatFrame = parent;
   setLayout(new GridLayout(5, 1));
   JPanel jp = new JPanel();
   tip = new JLabel(msg);
   tip.setFont(new Font("Serif", Font.BOLD, 16));
   jp.add(tip);
   add(jp);
   add(getPanel("用户名", userField));
   iconList.setPreferredSize(new Dimension(224, 20));
   add(getPanel("图    标", iconList));
   JPanel bp = new JPanel();
   loginBn.addActionListener(new MyActionListener(this));
   bp.add(loginBn);
   add(bp);
   pack();
   setVisible(true);
 }