Java Code Examples for javax.swing.JTextField#setBounds()
The following examples show how to use
javax.swing.JTextField#setBounds() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CachePanel.java From dkpro-jwpl with Apache License 2.0 | 6 votes |
private void createSQLProducerSettings() { sqlProducerLimitationsLabel = new JLabel( "SQLProducer Limitations (in byte)"); sqlProducerLimitationsLabel.setBounds(10, 210, 250, 25); this.add(sqlProducerLimitationsLabel); maxAllowedPacketLabel = new JLabel("MAX_ALLOWED_PACKET"); maxAllowedPacketLabel .setBorder(BorderFactory.createRaisedBevelBorder()); maxAllowedPacketLabel.setBounds(10, 240, 160, 25); this.add(maxAllowedPacketLabel); maxAllowedPacketField = new JTextField(); maxAllowedPacketField.setBounds(180, 240, 140, 25); this.add(maxAllowedPacketField); }
Example 2
Source File: LoggingPanel.java From dkpro-jwpl with Apache License 2.0 | 6 votes |
private void createDiffToolLoggingSettings() { diffToolLabel = new JLabel("Logging Root Folder: "); diffToolLabel.setBorder(BorderFactory.createRaisedBevelBorder()); diffToolLabel.setBounds(10, 10, 150, 25); this.add(diffToolLabel); diffToolField = new JTextField(); diffToolField.setBounds(170, 10, 200, 25); this.add(diffToolField); diffToolLogLevelComboBox = new JComboBox<>(); diffToolLogLevelComboBox.setBounds(390, 10, 100, 25); diffToolLogLevelComboBox.addItem(Level.ERROR); diffToolLogLevelComboBox.addItem(Level.WARN); diffToolLogLevelComboBox.addItem(Level.INFO); diffToolLogLevelComboBox.addItem(Level.DEBUG); diffToolLogLevelComboBox.addItem(Level.TRACE); this.add(diffToolLogLevelComboBox); }
Example 3
Source File: OutputPanel.java From dkpro-jwpl with Apache License 2.0 | 5 votes |
private void createOutputSizeSettings() { enableMultipleOutputFiles = new JCheckBox( "Allow multiple output files per consumer"); enableMultipleOutputFiles.setBounds(10, 200, 250, 25); this.add(enableMultipleOutputFiles); outputSizeLimitLabel = new JLabel("File Size Limit (in byte): "); outputSizeLimitLabel.setBorder(BorderFactory.createRaisedBevelBorder()); outputSizeLimitLabel.setBounds(10, 230, 150, 25); this.add(outputSizeLimitLabel); outputSizeLimitField = new JTextField(); outputSizeLimitField.setBounds(170, 230, 200, 25); this.add(outputSizeLimitField); enableMultipleOutputFiles.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { boolean flag = !controller.isMultipleOutputFiles(); controller.setMultipleOutputFiles(flag); outputSizeLimitLabel.setEnabled(flag); outputSizeLimitField.setEnabled(flag); } }); }
Example 4
Source File: InputPanel.java From dkpro-jwpl with Apache License 2.0 | 5 votes |
private void createEncodingSettings() { encodingLabel = new JLabel("Wikipedia Character Encoding: "); encodingLabel.setBorder(BorderFactory.createRaisedBevelBorder()); encodingLabel.setBounds(10, 230, 200, 25); this.add(encodingLabel); encodingField = new JTextField(); encodingField.setBounds(220, 230, 200, 25); this.add(encodingField); }
Example 5
Source File: HotelPropertiesWindow.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 5 votes |
private void setType() { int locationPoint = 323; for (int i = 0; i < 3; i++) { roomTypes = new JTextField(); roomTypes.setColumns(10); roomTypes.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null)); roomTypes.setBounds(locationPoint, 97, 86, 20); roomTypes.setVisible(false); bottomPanel.add(roomTypes); roomTypeFields[i] = roomTypes; locationPoint = locationPoint + 96; } }
Example 6
Source File: AbstractValueModelView.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * * @param valueModel */ public AbstractValueModelView ( ValueModel valueModel ) { this.valueModel = valueModel; valueTextBox = new JTextField(); valueTextBox.setBounds( 110, 0, 185, PANEL_HEIGHT ); this.add( valueTextBox ); uncertaintyTextBox = new JTextField(); uncertaintyTextBox.setBounds( 300, 0, 185, PANEL_HEIGHT ); this.add( uncertaintyTextBox ); valueModelNameLabel = new JLabel( RatioNamePrettyPrinter.makePrettyHTMLString( valueModel.getName() ) ); valueModelNameLabel.setBounds( // 0, // 0, // 100, // PANEL_HEIGHT ); valueModelNameLabel.setHorizontalAlignment( SwingConstants.RIGHT ); valueModelNameLabel.setFont(ReduxConstants.sansSerif_12_Bold ); this.add( valueModelNameLabel ); showOneSigmaAsPerCent = false; this.setBounds( 0, 0, PANEL_WIDTH, PANEL_HEIGHT ); }
Example 7
Source File: ConditionsQueryFrame.java From StudentSystem with Apache License 2.0 | 4 votes |
/** * * @param owner ���ĸ����� * @param title ������ * @param modal ָ����ģʽ���ڣ����з�ģʽ���� */ public ConditionsQueryFrame(JDialog owner, String title, boolean modal,JTable jt){ super(owner, title, modal); this.jd = this; this.setLayout(null); student_ID = new JLabel("ѧ��:"); student_ID.setBounds(29, 19, 30, 20); this.add(student_ID); student_IDText = new JTextField(); student_IDText.setBounds(65, 19, 100, 20); this.add(student_IDText); student_Name = new JLabel("����:"); student_Name.setBounds(200, 19, 30, 20); this.add(student_Name); student_NameText = new JTextField(); student_NameText.setBounds(240, 19, 100, 20); this.add(student_NameText); sex_Label = new JLabel("�Ա�:"); sex_Label.setBounds(29, 50, 30, 20); this.add(sex_Label); sex_Text = new JTextField(); sex_Text.setBounds(65, 50, 100, 20); this.add(sex_Text); grade_Label = new JLabel("�꼶:"); grade_Label.setBounds(200, 50, 30, 20); this.add(grade_Label); grade_Text = new JTextField(); grade_Text.setBounds(240, 50, 100, 20); this.add(grade_Text); department_Label = new JLabel("Ժϵ:"); department_Label.setBounds(29, 83, 30, 20); this.add(department_Label); department_Text = new JTextField(); department_Text.setBounds(65, 83, 100, 20); this.add(department_Text); major_Label = new JLabel("רҵ:"); major_Label.setBounds(200, 83, 30, 20); this.add(major_Label); major_Text = new JTextField(); major_Text.setBounds(240, 83, 100, 20); this.add(major_Text); classe_Label = new JLabel("�༶:"); classe_Label.setBounds(29,116, 30, 20); this.add(classe_Label); classe_Text = new JTextField(); classe_Text.setBounds(65, 116, 100, 20); this.add(classe_Text); conditions_button = new JButton("��������ѯ"); conditions_button.setBounds(230, 130, 100, 30); //ע��"��������ѯ"��ť�¼����� conditions_button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String id = student_IDText.getText().trim(); String name = student_NameText.getText().trim(); String sex = sex_Text.getText().trim(); String grade = grade_Text.getText().trim(); String department = department_Text.getText().trim(); String major = major_Text.getText().trim(); String classe = classe_Text.getText().trim(); if(id.equals("")&&name.equals("")&&sex.equals("")&&grade.equals("")&&department.equals("")&&major.equals("")&&classe.equals("")){ JOptionPane.showMessageDialog(jd, "��������Ϊ�գ�", "", JOptionPane.WARNING_MESSAGE); return ; }else{ String sql = CreateSql.getConditions_Sql(id, name, sex, grade, department, major, classe); StudentModel sm = new StudentModel(sql,jd); jt.setModel(sm); jd.dispose(); } } }); this.add(conditions_button); this.setSize(411, 222); this.setResizable(false); WindowUtil.setFrameCenter(this); this.setVisible(true); }
Example 8
Source File: ReplaceStringsOptions.java From bytecode-viewer with GNU General Public License v3.0 | 4 votes |
public ReplaceStringsOptions() { this.setIconImages(Resources.iconList); setSize(new Dimension(250, 176)); setResizable(false); setTitle("Replace Strings"); getContentPane().setLayout(null); JButton btnNewButton = new JButton("Start Replacing"); btnNewButton.setBounds(6, 115, 232, 23); getContentPane().add(btnNewButton); JLabel lblNewLabel = new JLabel("Original LDC:"); lblNewLabel.setBounds(6, 40, 67, 14); getContentPane().add(lblNewLabel); textField = new JTextField(); textField.setBounds(80, 37, 158, 20); getContentPane().add(textField); textField.setColumns(10); JLabel lblNewLabel_1 = new JLabel("New LDC:"); lblNewLabel_1.setBounds(6, 65, 77, 14); getContentPane().add(lblNewLabel_1); textField_1 = new JTextField(); textField_1.setColumns(10); textField_1.setBounds(80, 62, 158, 20); getContentPane().add(textField_1); JLabel lblNewLabel_2 = new JLabel("Class:"); lblNewLabel_2.setBounds(6, 90, 46, 14); getContentPane().add(lblNewLabel_2); textField_2 = new JTextField(); textField_2.setToolTipText("* will search all classes"); textField_2.setText("*"); textField_2.setBounds(80, 87, 158, 20); getContentPane().add(textField_2); textField_2.setColumns(10); final JCheckBox chckbxNewCheckBox = new JCheckBox( "Replace All Contains"); chckbxNewCheckBox .setToolTipText("If it's unticked, it will check if the string equals, if its ticked it will check if it contains, then replace the original LDC part of the string."); chckbxNewCheckBox.setBounds(6, 7, 232, 23); getContentPane().add(chckbxNewCheckBox); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { PluginManager.runPlugin(new ReplaceStrings(textField.getText(), textField_1.getText(), textField_2.getText(), chckbxNewCheckBox.isSelected())); dispose(); } }); this.setLocationRelativeTo(null); }
Example 9
Source File: BroadcastFrame.java From JRakNet with MIT License | 4 votes |
/** * Creates a broadcast test frame. */ protected BroadcastFrame() { // Frame and content settings this.setResizable(false); this.setSize(FRAME_WIDTH, FRAME_HEIGHT); this.setTitle("JRakNet Broadcast Test"); this.getContentPane().setLayout(null); // Discovered MCPE Servers JTextPane txtpnDiscoveredMcpeServers = new JTextPane(); txtpnDiscoveredMcpeServers.setEditable(false); txtpnDiscoveredMcpeServers.setBackground(UIManager.getColor("Button.background")); txtpnDiscoveredMcpeServers.setText("Discovered servers"); txtpnDiscoveredMcpeServers.setBounds(10, 10, 350, 20); this.getContentPane().add(txtpnDiscoveredMcpeServers); // How the client will discover servers on the local network JComboBox<String> comboBoxDiscoveryType = new JComboBox<String>(); comboBoxDiscoveryType.setToolTipText( "Changing this will update how the client will discover servers, by default it will look for any possible connection on the network"); comboBoxDiscoveryType.setModel(new DefaultComboBoxModel<String>(DISCOVERY_MODE_OPTIONS)); comboBoxDiscoveryType.setBounds(370, 10, 115, 20); comboBoxDiscoveryType.addActionListener(new RakNetBroadcastDiscoveryTypeListener()); this.getContentPane().add(comboBoxDiscoveryType); // Used to update the discovery port JTextField textFieldDiscoveryPort = new JTextField(); textFieldDiscoveryPort.setBounds(370, 45, 115, 20); textFieldDiscoveryPort.setText(Integer.toString(Discovery.getPorts()[0])); this.getContentPane().add(textFieldDiscoveryPort); textFieldDiscoveryPort.setColumns(10); JButton btnUpdatePort = new JButton("Update Port"); btnUpdatePort.setBounds(370, 76, 114, 23); btnUpdatePort.addActionListener(new RakNetBroadcastUpdatePortListener(textFieldDiscoveryPort)); this.getContentPane().add(btnUpdatePort); // The text containing the discovered MCPE servers txtPnDiscoveredMcpeServerList = new JTextPane(); txtPnDiscoveredMcpeServerList.setToolTipText("This is the list of the discovered servers on the local network"); txtPnDiscoveredMcpeServerList.setEditable(false); txtPnDiscoveredMcpeServerList.setBackground(UIManager.getColor("Button.background")); txtPnDiscoveredMcpeServerList.setBounds(10, 30, 350, 165); this.getContentPane().add(txtPnDiscoveredMcpeServerList); }
Example 10
Source File: WindowPlanes.java From txtUML with Eclipse Public License 1.0 | 4 votes |
public WindowPlanes() { JLabel newPlaneLabel = new JLabel("New plane:"); JLabel planesLabel = new JLabel("Planes:"); JLabel planeAngleLabel = new JLabel("Angle:"); JLabel newX = new JLabel("X: "); JLabel newY = new JLabel("Y: "); JTextField newXField = new JTextField("0"); JTextField newYField = new JTextField("0"); JTextField newAngleField = new JTextField("0"); JButton addPlane = new JButton("Add"); setLayout(null); add(newPlaneLabel); add(newX); add(newY); add(newXField); add(newYField); add(addPlane); add(planesLabel); add(planeAngleLabel); add(newAngleField); newPlaneLabel.setBounds(30, 10, 150, 25); newX.setBounds(74, 40, 20, 25); newY.setBounds(74, 70, 20, 25); newXField.setBounds(92, 42, 60, 25); newYField.setBounds(92, 72, 60, 25); planeAngleLabel.setBounds(50, 102, 75, 25); newAngleField.setBounds(92, 102, 60, 25); addPlane.setBounds(50, 134, 75, 25); planesLabel.setBounds(30, 179, 75, 25); addPlane.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Main.addNewPlane(Integer.parseInt(newXField.getText()), Integer.parseInt(newYField.getText()), Integer.parseInt(newAngleField.getText())); refresh(); } }); JLabel LId = new JLabel("ID"); JLabel LStatus = new JLabel("Status"); JLabel LX = new JLabel("X"); JLabel LY = new JLabel("Y"); JLabel LTower = new JLabel("Tower"); add(LId); add(LStatus); add(LX); add(LY); add(LTower); LId.setBounds(80, 209, 75, 25); LStatus.setBounds(195, 209, 75, 25); LX.setBounds(320, 209, 75, 25); LY.setBounds(380, 209, 75, 25); LTower.setBounds(440, 209, 75, 25); labelPlaneIds = new ArrayList<JLabel>(); labelPlaneStatus = new ArrayList<JLabel>(); labelPlaneXCoor = new ArrayList<JLabel>(); labelPlaneYCoor = new ArrayList<JLabel>(); labelTowerStatus = new ArrayList<JLabel>(); planeIds = new ArrayList<Integer>(); }
Example 11
Source File: DiscoMixer.java From aurous-app with GNU General Public License v2.0 | 4 votes |
/** * Initialize the contents of the frame. */ private void initialize() { discoFrame = new JFrame(); discoFrame.setTitle("Disco Mixer"); discoFrame.setIconImage(Toolkit.getDefaultToolkit().getImage( DiscoMixer.class.getResource("/resources/aurouslogo.png"))); discoFrame.setType(Type.UTILITY); discoFrame.setResizable(false); discoFrame.setBounds(100, 100, 606, 239); discoFrame .setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); discoFrame.getContentPane().setLayout(null); discoFrame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing( final java.awt.event.WindowEvent windowEvent) { final int confirm = JOptionPane.showOptionDialog(discoFrame, "Are You Sure You Want to Close Disco Mixer?", "Exit Confirmation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == 0) { Playlist.getPlaylist().discoOpen = false; discoFrame.dispose(); } } }); final JLabel logoLabel = new JLabel(""); logoLabel.setHorizontalAlignment(SwingConstants.CENTER); logoLabel.setIcon(new ImageIcon(DiscoMixer.class .getResource("/resources/fmw.png"))); logoLabel.setBounds(10, 0, 580, 70); discoFrame.getContentPane().add(logoLabel); discoProgressBar = new JProgressBar(); discoProgressBar.setStringPainted(true); discoProgressBar.setBounds(113, 119, 380, 49); discoProgressBar.setVisible(false); discoFrame.getContentPane().add(discoProgressBar); queryField = new JTextField(); queryField.setFont(new Font("Segoe UI", Font.PLAIN, 20)); queryField.setHorizontalAlignment(SwingConstants.CENTER); queryField.setBounds(113, 119, 380, 44); discoFrame.getContentPane().add(queryField); queryField.setColumns(10); final JLabel instructionsLabel = new JLabel( "Enter an Artist, Song or Choose from the Top 100!"); instructionsLabel.setFont(new Font("Segoe UI", Font.PLAIN, 20)); instructionsLabel.setHorizontalAlignment(SwingConstants.CENTER); instructionsLabel.setBounds(23, 81, 541, 27); discoFrame.getContentPane().add(instructionsLabel); discoBuildButton = new JButton("Disco!"); discoBuildButton.addActionListener(e -> { if (!queryField.getText().trim().isEmpty()) { discoProgressBar.setVisible(true); YouTubeDiscoUtils.buildDiscoPlayList(queryField.getText()); } else { JOptionPane.showMessageDialog(discoFrame, "Please enter search query", "Error", JOptionPane.ERROR_MESSAGE); return; } }); discoBuildButton.setForeground(Color.BLACK); discoBuildButton.setBounds(197, 174, 100, 26); discoFrame.getContentPane().add(discoBuildButton); top100Button = new JButton("Top Hits!"); top100Button.addActionListener(e -> { discoProgressBar.setVisible(true); YouTubeDiscoUtils.buildTopPlayList(); }); top100Button.setForeground(Color.BLACK); top100Button.setBounds(307, 174, 100, 26); discoFrame.getContentPane().add(top100Button); Playlist.getPlaylist().discoOpen = true; final GhostText ghostText = new GhostText("Ghost B.C.", queryField); ghostText.setHorizontalAlignment(SwingConstants.CENTER); discoFrame.setLocationRelativeTo(UISession.getPresenter().jfxPanel); }
Example 12
Source File: NetworkProxyConnectionPanel.java From Ardulink-1 with Apache License 2.0 | 4 votes |
/** * Create the panel. */ public NetworkProxyConnectionPanel() { Dimension dimension = new Dimension(275, 200); setPreferredSize(dimension); setMinimumSize(dimension); setLayout(null); connectionPanel = new SerialConnectionPanel(); connectionPanel.setLocation(0, 115); connectionPanel.setSize(connectionPanel.getPreferredSize()); connectionPanel.setEnabled(false); add(connectionPanel); JLabel lblHostName = new JLabel("Host Name:"); lblHostName.setHorizontalAlignment(SwingConstants.RIGHT); lblHostName.setBounds(6, 12, 91, 16); add(lblHostName); hostNameTextField = new JTextField(); hostNameTextField.setColumns(10); hostNameTextField.setBounds(108, 6, 161, 28); add(hostNameTextField); JLabel lblHostPort = new JLabel("Host Port:"); lblHostPort.setHorizontalAlignment(SwingConstants.RIGHT); lblHostPort.setBounds(6, 45, 91, 16); add(lblHostPort); hostPortTextField = new JTextField(); hostPortTextField.setColumns(10); hostPortTextField.setBounds(108, 39, 161, 28); hostPortTextField.setText(String.valueOf(NetworkProxyConnection.DEFAULT_LISTENING_PORT)); add(hostPortTextField); activateButton = new JButton("Activate Proxy"); activateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String hostName = hostNameTextField.getText(); if (nullOrEmpty(hostName)) { hostName = "127.0.0.1"; hostNameTextField.setText(hostName); } String hostPortString = hostPortTextField.getText(); int hostPort = -1; try { hostPort = Integer.parseInt(hostPortString); } catch(NumberFormatException nfe) { JOptionPane.showMessageDialog(hostPortTextField, "Invalid host port. " + hostPortString, "Error", JOptionPane.ERROR_MESSAGE); } if(hostPort != -1) { try { // Create a NetworkProxyConnection (the Connection implementation to send data over the net) // params are hostname and hostport NetworkProxyConnection connection = new NetworkProxyConnection(hostName, hostPort); // Create a Link class (so now we use this instead of the default one) link = Link.createInstance(hostPortTextField.getParent().toString(), connection); connectionPanel.setLink(link); connectionPanel.setEnabled(true); activateButton.setEnabled(false); hostNameTextField.setEnabled(false); hostPortTextField.setEnabled(false); } catch(Exception ex) { JOptionPane.showMessageDialog(hostPortTextField.getParent(), ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } }); activateButton.setBounds(5, 75, 264, 28); add(activateButton); }
Example 13
Source File: PayloadMessageConfig.java From ISO8583 with GNU General Public License v3.0 | 4 votes |
private GuiPayloadField(FieldVO fieldVO, FieldVO superfieldVO, String superFieldBitNum) { this.isSubfield = (superfieldVO != null); this.superFieldVO = superfieldVO; this.fieldVO = fieldVO.getInstanceCopy(); this.fieldVO.setFieldList(new ArrayList<FieldVO>()); if (isSubfield) { superFieldVO.getFieldList().add(this.fieldVO); } else { messageVO.getFieldList().add(this.fieldVO); } ckBox = new JCheckBox(); txtType = new JTextField(); txtLength = new JTextField(); txtValue = new JTextField(); subfieldList = new ArrayList<GuiPayloadField>(); lblFieldNum = new JLabel(superFieldBitNum +"["+ fieldVO.getBitNum().toString() +"]"); lblFieldName = new JLabel(fieldVO.getName()); lblType = new JLabel(fieldVO.getType().toString()); lblDynamic = new JLabel(); lblDynamic.setIcon(new ImageIcon(PnlGuiPayload.class.getResource("/org/adelbs/iso8583/resource/search.png"))); lblDynamic.setToolTipText(fieldVO.getDynaCondition()); lineNum = numLines; numLines++; ckBox.setBounds(10, 10 + (lineNum * 25), 22, 22); lblFieldNum.setBounds(40, 10 + (lineNum * 25), 60, 22); lblFieldName.setBounds(100, 10 + (lineNum * 25), 100, 22); lblType.setBounds(490, 10 + (lineNum * 25), 100, 22); lblDynamic.setBounds(620, 10 + (lineNum * 25), 50, 22); if (fieldVO.getType() == TypeEnum.ALPHANUMERIC) { txtValue.setBounds(210, 10 + (lineNum * 25), 260, 22); } else if (fieldVO.getType() == TypeEnum.TLV) { txtType.setBounds(210, 10 + (lineNum * 25), 80, 22); txtLength.setBounds(300, 10 + (lineNum * 25), 80, 22); txtValue.setBounds(390, 10 + (lineNum * 25), 80, 22); pnlFields.add(txtType); pnlFields.add(txtLength); } pnlFields.add(ckBox); pnlFields.add(lblFieldNum); pnlFields.add(lblFieldName); //Remove TypeLabel and TextField when we have SubFields. //Parent field has its value created by its subfields if(fieldVO.getFieldList().size() == 0 || fieldVO.getType() == TypeEnum.TLV){ pnlFields.add(txtValue); pnlFields.add(lblType); } txtType.addKeyListener(saveFieldPayloadAction); txtLength.addKeyListener(saveFieldPayloadAction); txtValue.addKeyListener(saveFieldPayloadAction); if (!fieldVO.getDynaCondition().equals("") && !fieldVO.getDynaCondition().equals("true")) pnlFields.add(lblDynamic); if (fieldVO.getDynaCondition().equals("true")) { ckBox.setSelected(true); ckBox.setEnabled(false); ckBoxClick(ckBox); setEnabled(true, false); } else { ckBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ckBoxClick((JCheckBox) e.getSource()); saveFieldValue(); } }); setEnabled(false, isSubfield); } }
Example 14
Source File: StudentSystemLoginFrame.java From StudentSystem with Apache License 2.0 | 4 votes |
public StudentSystemLoginFrame(){ super("ѧ���ɼ�����ϵͳ��¼����"); this.jf = this; this.setLayout(null);//����Ϊ�ղ��֡� this.setSize(400,300);//���ô�С�� Container c = this.getContentPane(); c.setBackground(Color.WHITE);//���ñ�����ɫ�� username_Label = new JLabel("�û���:"); //����"�û���"��ǩ�� username_Label.setBounds(100, 60, 50, 20); //����"�û���"��ǩλ�á� c.add(username_Label); //���"�û���"��ǩ�� username_Text = new JTextField(); //����"�û���"�ı��� username_Text.setBounds(160, 60, 120, 20); //����"�û���"�ı���λ�á� username_Text.grabFocus();//��ù�ꡣ c.add(username_Text); //���"�û���"�ı��� password_Label = new JLabel("����:"); //����"����"��ǩ�� password_Label.setBounds(100, 140, 50, 20); c.add(password_Label); //���"����"��ǩ�� password_Text = new JPasswordField(); //����"����"�ı��� password_Text.setBounds(160, 140, 120, 20); //����"����"�ı���λ�á� c.add(password_Text); //���"����"�ı��� login_Button = new JButton("��¼"); //����"��¼"��ť�� login_Button.setBounds(100, 210, 60, 20); //����"��¼"��ťλ�á� //ע��"��¼"��ť�¼������� login_Button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String username = username_Text.getText().trim(); String password = new String(password_Text.getPassword()); if(username.equals("")){ JOptionPane.showMessageDialog(jf, "�û�������Ϊ��","",JOptionPane.WARNING_MESSAGE); return ; } if(password.equals("")){ JOptionPane.showMessageDialog(jf, "���벻��Ϊ��","",JOptionPane.WARNING_MESSAGE); return ; } //��¼ҵ���� User user = new User();//�����û����� user.setUsername(username); user.setPassword(password); ManageHelper helper = new ManageHelper();//�������ݿ�ҵ������� if(helper.Login(user)){ //��½ҵ���� if(helper.Check_IsLogin(user)){ JOptionPane.showMessageDialog(jf, "�ظ���½��","",JOptionPane.WARNING_MESSAGE); return ; }else{ JOptionPane.showMessageDialog(jf, "��½�ɹ���"); jf.dispose();//�رյ�ǰ���ڡ� //�ĵ�½��� user.setIsLogin(1);//�ij�Ϊ�Ѿ���½�� helper.Update_IsLogin(user); //�������� user.setPassword("");//�������� StudentSystemMainFrame frame = new StudentSystemMainFrame(user); return ; } }else{ JOptionPane.showMessageDialog(jf, "�û������������"); Reset(); //���� return ; } } }); c.add(login_Button); //���"��¼"��ť �� register_Button = new JButton("ע��"); //����"ע��"��ť�� register_Button.setBounds(250, 210, 60, 20); //����"ע��"��ťλ�á� //ע��"ע��"��ť�¼������� register_Button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { jf.dispose(); //��ǰ���ڹرա� StudentSystemRegisterFrame studentSystemRegisterFrame = new StudentSystemRegisterFrame(); //��ע����� } }); c.add(register_Button); //���"ע��"��ť�� this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setResizable(false); //���ô�С���ɸı䡣 WindowUtil.setFrameCenter(this);//���ô��ھ��С� try { Image img = ImageIO.read(this.getClass().getResource("/2.png")); this.setIconImage(img); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } this.setVisible(true); //���ô���ɼ��� }
Example 15
Source File: QueryScoreFrame.java From StudentSystem with Apache License 2.0 | 4 votes |
/** * * @param owner ���ĸ����� * @param title ������ * @param modal ָ����ģʽ���ڣ����з�ģʽ���� */ public QueryScoreFrame(JDialog owner, String title, boolean modal,ScoreModel sm,int rowNum){ super(owner, title, modal); this.jd = this; this.setLayout(null); helper = new ManageHelper(); this.sm = sm; jtextFieldHashMap = new HashMap<String, JTextField>(); courses = helper.getCourse(helper.getAllMajor().get(sm.getValueAt(rowNum, 6)),sm.getValueAt(rowNum, 3).toString());//������пγ� scores = helper.getStudentScore(sm.getValueAt(rowNum, 0).toString());//����ѧ�Ż�ø�ѧ�������п�Ŀ�ɼ� int vgap = 0; //��ֱ��� for(int i=0;i<courses.size();i++){ JLabel jLabel = new JLabel(courses.get(i)+":"); jLabel.setBounds(78, 48+vgap, 120, 20); JTextField field = new JTextField(); field.setEditable(false); field.setText(scores.get(courses.get(i)));//���ı�����ӳɼ� field.setBounds(206, 48+vgap, 150, 20); jtextFieldHashMap.put(courses.get(i),field); //���������ı���ļ��� this.add(jLabel); this.add(field); vgap += 30; } confirm_button = new JButton("ȷ��"); confirm_button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub jd.dispose(); } }); confirm_button.setBounds(215, 48+vgap+5, 60, 20); this.add(confirm_button); this.setSize(450, 48+vgap+78); WindowUtil.setFrameCenter(this); this.setVisible(true); }
Example 16
Source File: LoginFrame.java From myqq with MIT License | 4 votes |
/** * Create the frame. */ public LoginFrame() { setTitle("QQ2013"); setIconImage(Toolkit.getDefaultToolkit().getImage(LoginFrame.class.getResource("/client/img/QQ_64.png"))); setUndecorated(true);//设置窗体没有边框 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 354, 272); contentPane = new MyPanel("../img/QQ2011_Login.png"); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); pwd密码 = new JPasswordField(); pwd密码.setText("123"); pwd密码.setEchoChar('●'); pwd密码.setBounds(104, 163, 154, 26); contentPane.add(pwd密码); lblQQ2013 = new JLabel("QQ2013"); lblQQ2013.setForeground(new Color(0, 0, 51)); lblQQ2013.setFont(new Font("宋体", Font.BOLD, 16)); lblQQ2013.setBounds(14, 6, 55, 18); contentPane.add(lblQQ2013); lbl头像 = new JLabel(""); lbl头像.setIcon(new ImageIcon(LoginFrame.class.getResource("/client/img/headImage/head_boy_01_64.jpg"))); lbl头像.setBounds(18, 127, 64, 64); contentPane.add(lbl头像); checkBox记住密码 = new JCheckBox("\u8BB0\u4F4F\u5BC6\u7801"); checkBox记住密码.setBounds(156, 198, 76, 18); contentPane.add(checkBox记住密码); checkBox自动登录 = new JCheckBox("\u81EA\u52A8\u767B\u5F55"); checkBox自动登录.setBounds(237, 198, 76, 18); contentPane.add(checkBox自动登录); lbl登录 = new JLabel(""); lbl登录.setIcon(new ImageIcon(LoginFrame.class.getResource("/client/img/button/button_login_1.png"))); lbl登录.setBounds(262, 237, 69, 22); contentPane.add(lbl登录); textField用户名 = new JTextField(); textField用户名.setText("\u9A6C\u5316\u817E"); textField用户名.setBounds(104, 128, 154, 26); contentPane.add(textField用户名); textField用户名.setColumns(10); lbl注册账号 = new JLabel("\u6CE8\u518C\u8D26\u53F7"); lbl注册账号.setFont(new Font("SansSerif", Font.PLAIN, 13)); lbl注册账号.setForeground(new Color(0, 51, 255)); lbl注册账号.setBounds(288, 132, 55, 18); contentPane.add(lbl注册账号); lbl忘记密码 = new JLabel("\u5FD8\u8BB0\u5BC6\u7801"); lbl忘记密码.setFont(new Font("SansSerif", Font.PLAIN, 13)); lbl忘记密码.setForeground(new Color(0, 51, 255)); lbl忘记密码.setBounds(288, 167, 55, 18); contentPane.add(lbl忘记密码); lbl最小化 = new JLabel(""); lbl最小化.setIcon(new ImageIcon(LoginFrame.class.getResource("/client/img/button/login_minsize_1.png"))); lbl最小化.setBounds(284, 0, 29, 19); contentPane.add(lbl最小化); lbl退出 = new JLabel(""); lbl退出.setIcon(new ImageIcon(LoginFrame.class.getResource("/client/img/button/login_exit_1.png"))); lbl退出.setBounds(312, -1, 37, 20); contentPane.add(lbl退出); lbl多账号 = new JLabel(""); lbl多账号.setIcon(new ImageIcon(LoginFrame.class.getResource("/client/img/button/login_duozhanghao_1.png"))); lbl多账号.setBounds(14, 237, 69, 21); contentPane.add(lbl多账号); lbl设置 = new JLabel(""); lbl设置.setIcon(new ImageIcon(LoginFrame.class.getResource("/client/img/button/login_setting_1.png"))); lbl设置.setBounds(93, 237, 69, 21); contentPane.add(lbl设置); comboBox状态 = new JComboBox(); comboBox状态.setBounds(104, 195, 40, 24); contentPane.add(comboBox状态); }
Example 17
Source File: RouterClientTest.java From jRUDP with MIT License | 4 votes |
private RouterClientTest() { setResizable(false); setTitle("jRUDP Client Test"); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(289, 500); setLocationRelativeTo(null); getContentPane().setLayout(null); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) {} JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 69, 263, 156); getContentPane().add(scrollPane); lblRecPacketQueue = new JLabel("Received Packet Queue (Front==index#0)"); scrollPane.setColumnHeaderView(lblRecPacketQueue); JList<String> listPacketQueue = new JList<>(); listPacketQueue.setEnabled(false); listPacketQueue.setModel(modelRecPackets); scrollPane.setViewportView(listPacketQueue); btnConnection = new JButton("Connect"); btnConnection.addActionListener((action)->{ if(clientInstance != null && clientInstance.isConnected()) { disconnectWGui(); } else { connectWGui(); } }); btnConnection.setBounds(10, 438, 263, 23); getContentPane().add(btnConnection); tfServerPort = new JTextField(); tfServerPort.setText(ST_SERVER_PORT + ""); tfServerPort.setBounds(96, 407, 177, 20); tfServerPort.setColumns(10); getContentPane().add(tfServerPort); tfServerHost = new JTextField(); tfServerHost.setText(ST_SERVER_HOST); tfServerHost.setColumns(10); tfServerHost.setBounds(96, 376, 177, 20); getContentPane().add(tfServerHost); JLabel lblServerHost = new JLabel("Server Host:"); lblServerHost.setBounds(23, 379, 71, 14); getContentPane().add(lblServerHost); JLabel lblServerPort = new JLabel("Server Port:"); lblServerPort.setBounds(23, 410, 71, 14); getContentPane().add(lblServerPort); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane_1.setBounds(10, 236, 263, 126); getContentPane().add(scrollPane_1); taConsole = new JTextArea(); taConsole.setLineWrap(true); taConsole.setWrapStyleWord(true); taConsole.setEditable(false); taConsole.setBackground(Color.LIGHT_GRAY); taConsole.setFont(new Font("SansSerif", Font.BOLD, 11)); scrollPane_1.setViewportView(taConsole); taHandledPacket = new JTextArea(); taHandledPacket.setEditable(false); taHandledPacket.setEnabled(false); taHandledPacket.setFont(new Font("SansSerif", Font.BOLD, 11)); taHandledPacket.setText("Last Handled Packet:\r\nnull"); taHandledPacket.setBounds(10, 11, 263, 47); getContentPane().add(taHandledPacket); setVisible(true); System.setOut(new PrintStream(new OutputStream() { @Override public void write(int b) throws IOException { taConsole.append("" + (char)b); taConsole.setSize(taConsole.getPreferredSize()); JScrollBar sb = scrollPane_1.getVerticalScrollBar(); sb.setValue( sb.getMaximum() ); } })); System.out.println("[INFO]Console: on"); setVisible(true); }
Example 18
Source File: TesteComponentes.java From dctb-utfpr-2018-1 with Apache License 2.0 | 4 votes |
public void TesteComponente(){ janela.setVisible(true); janela.setSize(DIMENSOES); janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JScrollPane teste1 = new JScrollPane(painel); teste1.setBounds(1, 2, 150, 200); JButton teste2 = new JButton("Aperte"); teste2.setBounds(210, 2, 100, 100); JToggleButton teste3 = new JToggleButton("Toggle"); teste3.setBounds(320, 2, 100, 100); JCheckBox teste4 = new JCheckBox("Teste"); teste4.setBounds(430, 2, 100, 100); JRadioButton teste5 = new JRadioButton("Teste2"); teste5.setBounds(540, 2, 100, 100); JTextField teste6 = new JTextField(); teste6.setToolTipText("Seu Nome"); teste6.setBounds(1, 205, 200, 50); String[] numeros = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; JList teste7 = new JList(numeros); JScrollPane teste7_2 = new JScrollPane(teste7); teste7_2.setBounds(210, 205, 100, 100); String[] numeros2 = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; JComboBox teste8 = new JComboBox(numeros2); teste8.setBounds(320, 205, 50, 50); JLabel teste9 = new JLabel(); teste9.setText("Biografia: "); teste9.setBounds(1, 290, 200, 100); JTextArea teste10 = new JTextArea(); teste10.setToolTipText("Biografia"); teste10.setBounds(1, 350, 100, 100); teste2.addActionListener(this); teste3.addActionListener(this); teste4.addActionListener(this); teste5.addActionListener(this); janela.add(teste1); janela.add(teste2); janela.add(teste3); janela.add(teste4); janela.add(teste5); janela.add(teste6); janela.add(teste7); janela.add(teste8); janela.add(teste9); janela.add(teste10); }
Example 19
Source File: XDMFileSelectionPanel.java From xdm with GNU General Public License v2.0 | 4 votes |
private void initUI() { setBackground(ColorResource.getDarkestBgColor()); txtFile = new JTextField(); setBorder(new LineBorder(ColorResource.getSelectionColor(), 1)); txtFile.setBackground(ColorResource.getDarkestBgColor()); txtFile.setBorder(null); txtFile.setForeground(Color.WHITE); txtFile.setBounds(getScaledInt(77), getScaledInt(111), getScaledInt(241), getScaledInt(20)); txtFile.setCaretColor(ColorResource.getSelectionColor()); add(txtFile); Box hbox = Box.createHorizontalBox(); btnBrowse = new CustomButton(); btnBrowse.setBackground(ColorResource.getDarkestBgColor()); btnBrowse.setIcon(ImageResource.getIcon("folder.png", 16, 16)); btnBrowse.setMargin(new Insets(0, 0, 0, 0)); btnBrowse.setContentAreaFilled(false); btnBrowse.setBorderPainted(false); btnBrowse.setFocusPainted(false); btnBrowse.setOpaque(false); btnBrowse.addActionListener(this); btnDropdown = new CustomButton(); btnDropdown.setBackground(ColorResource.getDarkestBgColor()); btnDropdown.setIcon(ImageResource.getIcon("down_white.png",16,16)); btnDropdown.setMargin(new Insets(0, 0, 0, 0)); btnDropdown.setContentAreaFilled(false); btnDropdown.setBorderPainted(false); btnDropdown.setFocusPainted(false); btnDropdown.addActionListener(this); hbox.add(btnBrowse); hbox.add(btnDropdown); add(hbox, BorderLayout.EAST); pop = new JPopupMenu(); if (!StringUtils.isNullOrEmptyOrBlank(Config.getInstance().getLastFolder())) { pop.add(createMenuItem(Config.getInstance().getLastFolder())); } pop.add(createMenuItem(Config.getInstance().getDownloadFolder())); if (!Config.getInstance().isForceSingleFolder()) { pop.add(createMenuItem(Config.getInstance().getCategoryDocuments())); pop.add(createMenuItem(Config.getInstance().getCategoryMusic())); pop.add(createMenuItem(Config.getInstance().getCategoryPrograms())); pop.add(createMenuItem(Config.getInstance().getCategoryCompressed())); pop.add(createMenuItem(Config.getInstance().getCategoryVideos())); } pop.setInvoker(btnDropdown); }
Example 20
Source File: SerialConnectionPanel.java From Ardulink-1 with Apache License 2.0 | 4 votes |
/** * Create the panel. */ public SerialConnectionPanel() { // decomment this to use simple byte protocol // link = Link.getInstance("serialConnection"); // if(link == null) { // Set<String> protocolNames = ProtocolHandler.getInstalledProtocolImplementationNames(); // if(!protocolNames.contains(SimpleBinaryProtocol.NAME)) { // ProtocolHandler.installProtocolImplementation(new SimpleBinaryProtocol()); // } // link = Link.createInstance("serialConnection", SimpleBinaryProtocol.NAME); // } Dimension dimension = new Dimension(275, 80); setPreferredSize(dimension); setMinimumSize(dimension); setLayout(null); JLabel connectionPortLabel = new JLabel("Connection Port:"); connectionPortLabel.setHorizontalAlignment(SwingConstants.RIGHT); connectionPortLabel.setBounds(6, 16, 91, 16); add(connectionPortLabel); connectionPortComboBox = new JComboBox(); connectionPortComboBox.setBounds(108, 10, 122, 28); add(connectionPortComboBox); lblBaudRate = new JLabel("Baud Rate:"); lblBaudRate.setHorizontalAlignment(SwingConstants.RIGHT); lblBaudRate.setBounds(6, 44, 91, 16); add(lblBaudRate); baudRateTextField = new JTextField(); baudRateTextField.setText(String.valueOf(Link.DEFAULT_BAUDRATE)); baudRateTextField.setColumns(10); baudRateTextField.setBounds(108, 38, 122, 28); add(baudRateTextField); discoverButton = new JButton(""); discoverButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { List<String> portList = link.getPortList(); // portList = new ArrayList<String>(); // Mock code... // portList.add("COM19"); // portList.add("COM20"); if(portList != null && !portList.isEmpty()) { connectionPortComboBox .setModel(new DefaultComboBoxModel(portList .toArray(new String[portList.size()]))); } else { connectionPortComboBox.removeAllItems(); } } }); discoverButton.setIcon(new ImageIcon(SerialConnectionPanel.class.getResource("icons/search_icon.png"))); discoverButton.setToolTipText("Discover"); discoverButton.setBounds(235, 8, 32, 32); add(discoverButton); }