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); }
public Graficos() { JFrame jfMain = new JFrame("HC12"); jfMain.setLayout(null); gridJP(); jbtnLoad = new JButton("Cargar Archivo asm"); jbtnLoad.setBounds(10, 10, 200, 30); jbtnProcess = new JButton("Procesar"); jbtnProcess.setBounds(320, 270, 100, 30); labelAsm = new JLabel("Archivo .ASM original"); labelAsm.setBounds(10, 45, 300, 15); labelInst = new JLabel("Archivo .INST"); labelInst.setBounds(430, 45, 300, 15); labelErr = new JLabel("Archivo .ERR"); labelErr.setBounds(800, 45, 300, 15); jtxtAsm = new JTextArea(); jsrpAsm = new JScrollPane(jtxtAsm); jtxtAsm.setBounds(0, 0, 1000, 1000); jtxtAsm.setEditable(false); jsrpAsm.setBounds(10, 60, 300, 450); jtxtInst = new JTextArea(); jsrpInst = new JScrollPane(jtxtInst); jtxtInst.setBounds(0, 0, 1000, 1000); jtxtInst.setEditable(false); jsrpInst.setBounds(430, 60, 300, 450); jtxtErr = new JTextArea(); jsrpErr = new JScrollPane(jtxtErr); jtxtErr.setBounds(0, 0, 1000, 1000); jtxtErr.setEditable(false); jsrpErr.setBounds(800, 60, 300, 450); jfMain.add(jbtnLoad); jfMain.add(jbtnProcess); jfMain.add(jsrpAsm); jfMain.add(jsrpInst); jfMain.add(jsrpErr); jfMain.add(labelAsm); jfMain.add(labelInst); jfMain.add(labelErr); jbtnLoad.addActionListener(this); jbtnProcess.addActionListener(this); jfMain.setLocation(50, 50); jfMain.setResizable(false); jfMain.setVisible(true); jfMain.setSize(1300, 600); jfMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
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); }
public CFSecuritySwingISOCurrencyAskDeleteJPanel( ICFSecuritySwingSchema argSchema, ICFSecurityISOCurrencyObj argFocus) { super(); final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; // Construct the various objects textAreaMessage = new JTextArea("Are you sure you want to delete this ISO Currency?"); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); attrJPanel = argSchema.getISOCurrencyFactory().newAttrJPanel(argFocus); scrollPane = new CFHSlaveJScrollPane(attrJPanel); // Lay out the widgets setSize(1024, 480); Dimension min = new Dimension(480, 300); setMinimumSize(min); add(textAreaMessage); textAreaMessage.setBounds(0, 0, 1024, 50); int xparts = (768 - (2 * 125)) / 3; add(buttonOk); buttonOk.setBounds(xparts, 55, 125, 40); add(buttonCancel); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); add(scrollPane); scrollPane.setBounds(0, 100, 1024, 480 - 100); }
private JPanel getJContentPane() { if (jContentPane == null) { jLabel6 = new JLabel(); jLabel6.setBounds(new Rectangle(11, 72, 218, 19)); jLabel6.setText("Install log directory:"); jLabel5 = new JLabel(); jLabel5.setBounds(new Rectangle(11, 2, 394, 26)); jLabel5.setText("Advanced Install. Please select your preferences"); ButtonGroup group = new ButtonGroup(); pathSuffix = new JTextArea(); pathSuffix.setBounds(new Rectangle(232, 48, 61, 21)); pathSuffix.setText("BIRCH"); jLabel4 = new JLabel(); jLabel4.setBounds(new Rectangle(22, 351, 312, 20)); jLabel4.setText("* - Automatically detected, recommended."); jLabel3 = new JLabel(); jLabel3.setBounds(new Rectangle(220, 48, 10, 21)); jLabel3.setText(" /"); jLabel2 = new JLabel(); jLabel2.setBounds(new Rectangle(18, 250, 132, 18)); jLabel2.setText("Binaries:"); jLabel1 = new JLabel(); jLabel1.setBounds(new Rectangle(11, 115, 127, 21)); jLabel1.setText("Framework Type:"); jLabel = new JLabel(); jLabel.setBounds(new Rectangle(11, 28, 131, 17)); jLabel.setText("Install directory:"); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.setSize(new Dimension(464, 376)); jContentPane.add(jLabel, null); jContentPane.add(getJButton(), null); jContentPane.add(getJTextArea(), null); jContentPane.add(jLabel3, null); jContentPane.add(pathSuffix, null); jContentPane.add(jLabel1, null); jContentPane.add(getJCheckBox(), null); jContentPane.add(getJCheckBox1(), null); jContentPane.add(jLabel2, null); jContentPane.add(getJCheckBox2(), null); jContentPane.add(getJCheckBox3(), null); jContentPane.add(getJCheckBox4(), null); jContentPane.add(getJCheckBox5(), null); jContentPane.add(getJCheckBox6(), null); jContentPane.add(getLogTextField(), null); jContentPane.add(getLogButton(), null); jContentPane.add(jLabel4, null); jContentPane.add(getWindows32Checkbox(), null); jContentPane.add(getJRadioButton(), null); jContentPane.add(jLabel5, null); jContentPane.add(jLabel6, null); jContentPane.add(getGitRadioButton(), null); jContentPane.add(getGitComboBox(), null); group.add(releaseRadioButton); group.add(developmentRadioButton); group.add(gitRadioButton); } return jContentPane; }
/** * This method initializes voorbeeldGebied * * @return javax.swing.JTextArea */ private JTextArea getVoorbeeldGebied() { if (voorbeeldGebied == null) { voorbeeldGebied = new JTextArea(); voorbeeldGebied.setBounds(new Rectangle(16, 105, 244, 90)); voorbeeldGebied.setText(""); } return voorbeeldGebied; }
/** * This method initializes txtCirujias * * @return javax.swing.JTextArea */ private JTextArea getTxtCirujias() { if (txtCirujias == null) { txtCirujias = new JTextArea(); txtCirujias.setBorder( BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black, 1))); txtCirujias.setBounds(new Rectangle(183, 226, 278, 111)); } return txtCirujias; }
public void doLayout() { Dimension sz = getSize(); textAreaMessage.setBounds(0, 0, sz.width, 50); int xparts = (sz.width - (2 * 125)) / 3; buttonOk.setBounds(xparts, 55, 125, 40); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); scrollPane.setBounds(0, 100, sz.width, sz.height - 100); scrollPane.doLayout(); }
public ShowComp() throws InterruptedException, IOException { super("CONNECTED COMPUTERS"); int x = 0, d = 20; mb = new JMenuBar(); File = new JMenu("File"); mb.add(File); exit = new JMenuItem("Exit"); exit.addActionListener(this); File.add(exit); ta = new JTextArea(); ta.setBounds(20, 30, 315, 470); ta.setEditable(false); add(ta); setJMenuBar(mb); sel = new JLabel("The connected computers are.."); sel.setBounds(15, 5, 300, 30); add(sel); b1 = new JButton("<< BACK"); b1.setBounds(140, 510, 100, 30); b1.setToolTipText("Back to main page"); b1.addActionListener(this); add(b1); setLayout(null); while (x < 360) { x = x + d; setBounds(675, 50, x, 600); this.show(); } // setVisible(true); String s = "192.168.0.", temp = null; Printer printer = new Printer(); printer.start(); Connector connector = new Connector(printer); connector.start(); LinkedList targets = new LinkedList(); for (int i = 1; i <= 255; i++) { temp = s + Integer.toString(i); Target t = new Target(temp); targets.add(t); connector.add(t); } Thread.sleep(2000); connector.shutdown(); connector.join(); for (Iterator i = targets.iterator(); i.hasNext(); ) { Target t = (Target) i.next(); if (!t.shown) t.show(); } setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
/** * Creates the terminal for interaction with client from server * * @param s */ public Terminal(Server s) { mServer = s; TextFieldListener tfListener = new TextFieldListener(); input.addActionListener(tfListener); Display = new javax.swing.JLayeredPane(); input.setColumns(50); output.setColumns(50); output.setRows(30); output.setEditable(false); output.setBackground(Color.BLACK); output.setForeground(Color.WHITE); input.requestFocus(); // start with focus on this field output.setBounds(0, 0, 550, 310); Display.add(output, javax.swing.JLayeredPane.DEFAULT_LAYER); input.setBounds(0, 320, 550, 25); Display.add(input, javax.swing.JLayeredPane.DEFAULT_LAYER); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent( Display, javax.swing.GroupLayout.PREFERRED_SIZE, 550, javax.swing.GroupLayout.PREFERRED_SIZE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( Display, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)))); pack(); }
// create and position GUI components; register event handlers private void createUserInterface() { // get content pane for attaching GUI components Container contentPane = getContentPane(); // enable explicit positioning of GUI components contentPane.setLayout(null); // set up principalJLabel principalJLabel = new JLabel(); principalJLabel.setBounds(20, 20, 80, 20); principalJLabel.setText("Principal:"); contentPane.add(principalJLabel); // set up principalJTextField principalJTextField = new JTextField(); principalJTextField.setBounds(80, 20, 90, 20); principalJTextField.setText("0"); principalJTextField.setHorizontalAlignment(JTextField.RIGHT); contentPane.add(principalJTextField); // set up resultJLabel resultJLabel = new JLabel(); resultJLabel.setBounds(20, 60, 100, 20); resultJLabel.setText("Result:"); contentPane.add(resultJLabel); // set up resultJTextArea resultJTextArea = new JTextArea(); resultJTextArea.setBounds(20, 85, 260, 120); resultJTextArea.setEditable(false); contentPane.add(resultJTextArea); // set up calculateJButton calculateJButton = new JButton(); calculateJButton.setBounds(190, 20, 90, 20); calculateJButton.setText("Calculate"); contentPane.add(calculateJButton); calculateJButton.addActionListener( new ActionListener() // anonymous inner class { // event handler called when calculateJButton is pressed public void actionPerformed(ActionEvent event) { calculateJButtonActionPerformed(event); } } // end anonymous inner class ); // end call to addActionListener // set properties of application's window setTitle("Comparing Rates"); // set title bar text setSize(310, 255); // set window size setVisible(true); // display window } // end method createUserInterface
public JTextArea addTextArea( int boundsX, int boundsY, int boundsWidth, int boundsHeight, boolean editable) { JTextArea textOutput = new JTextArea(); textOutput.setBounds(boundsX, boundsY, boundsWidth, boundsHeight); textOutput.setEditable(editable); Border myBorder = BorderFactory.createLineBorder(Color.black); textOutput.setBorder(myBorder); // add the text area to the view System.out.println("text area added"); return textOutput; }
private void initGUI() { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { panelFondo = new JPanel(); getContentPane().add(panelFondo, BorderLayout.CENTER); panelFondo.setLayout(null); { jLnombrePersonaje = new JLabel(); panelFondo.add(jLnombrePersonaje); jLnombrePersonaje.setText("Nombre"); jLnombrePersonaje.setBounds(17, 26, 94, 27); } { jTFNombrePersonaje = new JTextField(); panelFondo.add(jTFNombrePersonaje); jTFNombrePersonaje.setBounds(129, 12, 230, 41); jTFNombrePersonaje.setName("JTFNombreNuevoPersonaje"); } { jLDescripcion = new JLabel(); panelFondo.add(jLDescripcion); jLDescripcion.setText("Descripcion"); jLDescripcion.setBounds(17, 82, 104, 35); } { jTFDescripcion = new JTextArea(); panelFondo.add(jTFDescripcion); jTFDescripcion.setBounds(121, 82, 238, 93); jTFDescripcion.setName("JTFDescripcionNuevoPersonaje"); } { jBAceptar = new JButton(); panelFondo.add(jBAceptar); jBAceptar.setText("Aceptar"); jBAceptar.setName("JBAceptarNuevoPerosnaje"); jBAceptar.setBounds(56, 212, 112, 23); } { jBCancelar = new JButton(); panelFondo.add(jBCancelar); jBCancelar.setText("Cancelar"); jBCancelar.setName("JBCancelarNuevoPersonaje"); jBCancelar.setBounds(217, 212, 121, 23); } } pack(); setSize(400, 300); }
/** * This method initializes jTextArea * * @return javax.swing.JTextArea */ private JTextArea getJTextArea() { if (installDirTextArea == null) { String path; path = System.getProperty("user.home"); installDirTextArea = new JTextArea(); installDirTextArea.setEditable(false); installDirTextArea.setText(System.getProperty("user.home")); installDirTextArea.setBounds(new Rectangle(13, 49, 206, 21)); } return installDirTextArea; }
private void GUI() { // gui components JFrame frame = new JFrame(); JPanel pane = new JPanel(); // buttons and areas JTextArea uName = new JTextArea("Spy Alias"); JTextArea pWord = new JTextArea("Top Secret Password"); JButton submit = new JButton("Login"); JButton register = new JButton("Register"); // sizing GUI components submit.setBounds(545, 260, 100, 50); register.setBounds(650, 260, 100, 50); uName.setBounds(545, 200, 100, 50); pWord.setBounds(650, 200, 100, 50); // adding action listeners submit.addActionListener(this); // sizing, making visible, and adding pane to Frame frame.setLayout(null); frame.setVisible(true); frame.setSize(1600, 850); frame.add(pane); // adding components to panel and sizing pane.setLayout(null); pane.setSize(1600, 850); pane.add(uName); pane.add(pWord); pane.add(submit); pane.add(register); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); }
private void addTextField() { messageArea = new JTextArea(); messageArea.setEnabled(false); messageArea.setDisabledTextColor(Color.BLACK); listArea = new JTextArea(); listArea.setEnabled(false); listArea.setDisabledTextColor(Color.BLACK); listArea.setBounds(275, 18, 70, 340); contentPane.add(listArea); textField = new JTextField(); textField.setBounds(0, 312, 155, 42); textField.addKeyListener(this); contentPane.add(textField); textField.setColumns(10); }
// constructeur de la classe Demo1(String s) { javax.swing.JFrame f = new javax.swing.JFrame("Demo " + s); f.setSize(400, 300); f.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); javax.swing.JTextArea ta = new javax.swing.JTextArea(); ta.setBounds(80, 40, 300, 150); javax.swing.JButton b1 = new javax.swing.JButton("OK"); b1.setBounds(80, 200, 80, 50); javax.swing.JButton b2 = new javax.swing.JButton("cancel"); b2.setBounds(180, 200, 80, 50); f.setLayout(null); f.add(ta); f.add(b1); f.add(b2); f.setVisible(true); }
public MainScreen(Out out) { beep = new JButton("Beep"); beep.addActionListener(this); beeps = new JButton("Beeps"); beeps.addActionListener(this); reset = new JButton("Reset"); reset.addActionListener(this); name = new JButton("Name"); name.addActionListener(this); version = new JButton("Version"); version.addActionListener(this); clear = new JButton("Clear"); clear.addActionListener(this); area = new JTextArea(30, 80); id = new JTextField(25); id.setEditable(false); this.out = out; setSize(640, 480); setVisible(false); setTitle("PROMAG"); setLayout(null); getContentPane().add(beep); getContentPane().add(beeps); getContentPane().add(reset); getContentPane().add(name); getContentPane().add(version); getContentPane().add(clear); getContentPane().add(id); getContentPane().add(area); beep.setBounds(540, 10, 80, 30); beeps.setBounds(540, 60, 80, 30); reset.setBounds(540, 110, 80, 30); name.setBounds(540, 160, 80, 30); version.setBounds(540, 210, 80, 30); clear.setBounds(540, 260, 80, 30); id.setBounds(540, 310, 80, 30); area.setBounds(10, 10, 520, 470); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public TexturePackCellRenderer() { super(); logo = new JLabel(); description = new JTextArea(); setLayout(null); logo.setBounds(6, 6, 42, 42); description.setBorder(null); description.setEditable(false); description.setForeground(Color.white); description.setBounds(58, 6, 378, 42); description.setBackground(new Color(255, 255, 255, 0)); add(description); add(logo); setMinimumSize(new Dimension(420, 55)); setPreferredSize(new Dimension(420, 55)); }
/** 删除教务处老师或院系教务老师: 若还有其他该角色的老师则直接删除, 否则要求用户添加一名新的老师,若不添加则不能删除 */ private void deleteJW(final int row, String role) { AdminBLService ad = new AdminController(); ArrayList<UserVo> user = ad.getUser(role); if (user.size() > 1) { String result = ad.deleteUser( new UserVo((String) table.getValueAt(row, 0), role, "", "", "", "", "", "", 0, "")); Methods.showTip(result); } else { JDialog tip = new JDialog(); tip.getContentPane().setLayout(null); tip.setTitle("~~~"); tip.setSize(350, 200); tip.setLocationRelativeTo(null); JTextArea area = new JTextArea("请先添加一名新的用户来接管该" + Methods.eToC(role) + "的\r\n工作再执行删除"); area.setBounds(42, 44, 260, 60); tip.getContentPane().add(area); tip.setVisible(true); } }
Swing4(String s) { f=new JFrame(s); ta=new JTextArea(); ta.setBounds(50,50,400,200); f.add(ta); tf=new JTextField(); tf.setBounds(50,300,100,50); f.add(tf); b=new JButton("FIND"); b.setBounds(200,300,100,50); b.addActionListener(this); f.add(b); b1=new JButton("NEXT"); b1.setBounds(350,300,100,50); b1.addActionListener(this); b1.setVisible(false); f.add(b1); tf1=new JTextField(); tf1.setBounds(50,400,100,50); f.add(tf1); b2=new JButton("REPLACE"); b2.setBounds(200,400,100,50); b2.addActionListener(this); f.add(b2); f.setLayout(null); f.setSize(500,500); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
/** Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Field with information about online clients field_clients_online = new JTextField("No clients online"); field_clients_online.setBounds(10, 10, 200, 20); field_clients_online.setHorizontalAlignment(0); field_clients_online.setEditable(false); field_clients_online.setVisible(true); frame.add(field_clients_online); combo_clients_online = new JComboBox<String>(); combo_clients_online.setBounds(10, 40, 200, 30); combo_clients_online.setVisible(true); frame.add(combo_clients_online); area_messages = new JTextArea(); area_messages.setBounds(10, 80, 400, 100); area_messages.setVisible(true); frame.add(area_messages); combo_clients_online.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String client = combo_clients_online.getSelectedItem().toString(); System.out.println(client); } }); this.db_query = new Query(); updateStatus(); }
/** * Initialize the contents of the frame. * * @throws UnsupportedLookAndFeelException * @throws IllegalAccessException * @throws InstantiationException * @throws ClassNotFoundException */ private void initialize() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); frmCalendarpropgenerator = new JFrame(); frmCalendarpropgenerator.setTitle("CalendarPropGenerator"); frmCalendarpropgenerator.setResizable(false); frmCalendarpropgenerator.setBounds(100, 100, 892, 506); frmCalendarpropgenerator.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmCalendarpropgenerator.getContentPane().setLayout(null); JLabel lblCliendId = new JLabel("Cliend ID:"); lblCliendId.setBounds(45, 77, 90, 14); frmCalendarpropgenerator.getContentPane().add(lblCliendId); JLabel lblNewLabel = new JLabel("Client secret:"); lblNewLabel.setBounds(45, 127, 108, 14); frmCalendarpropgenerator.getContentPane().add(lblNewLabel); txtClientId = new JTextField(); txtClientId.setBounds(202, 74, 410, 20); frmCalendarpropgenerator.getContentPane().add(txtClientId); txtClientId.setColumns(10); txtClientSecret = new JTextField(); txtClientSecret.setBounds(202, 124, 410, 20); frmCalendarpropgenerator.getContentPane().add(txtClientSecret); txtClientSecret.setColumns(10); console = new JTextArea(); console.setLineWrap(true); console.setWrapStyleWord(true); console.setBounds(10, 259, 864, 199); frmCalendarpropgenerator.getContentPane().add(console); JLabel lblAccesstoken = new JLabel("Authorization Code:"); lblAccesstoken.setBounds(45, 179, 163, 14); frmCalendarpropgenerator.getContentPane().add(lblAccesstoken); txtAuthCode = new JTextField(); txtAuthCode.setEditable(false); txtAuthCode.setBounds(202, 176, 410, 20); frmCalendarpropgenerator.getContentPane().add(txtAuthCode); txtAuthCode.setColumns(10); btnGenPropFile = new JButton("Generate properties file"); btnGenPropFile.setEnabled(false); btnGenPropFile.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String code = txtAuthCode.getText(); if (code.isEmpty()) { JOptionPane.showMessageDialog(null, "Insert the Auth code to proceed."); } else { // End of Step 1 <-- // Step 2: Exchange --> // AccessTokenResponse response = new GoogleAuthorizationCodeGrant( // httpTransport, jsonFactory, clientId, clientSecret, code, // redirectUrl).execute(); // End of Step 2 <-- HttpTransport httpTransport = new NetHttpTransport(); JacksonFactory jsonFactory = new JacksonFactory(); String redirectUrl = "urn:ietf:wg:oauth:2.0:oob"; String scope = "https://www.googleapis.com/auth/calendar"; GoogleAuthorizationCodeTokenRequest tokenReq = new GoogleAuthorizationCodeTokenRequest( httpTransport, jsonFactory, txtClientId.getText(), txtClientSecret.getText(), code, redirectUrl); GoogleTokenResponse tokenResp; try { tokenResp = tokenReq.execute(); TokenResponse returnedToken = new TokenResponse(); returnedToken.setAccessToken(tokenResp.getAccessToken()); returnedToken.setRefreshToken(tokenResp.getRefreshToken()); // Set and store tokens - old // accessToken = response.accessToken; // refreshToken = response.refreshToken; // Set and store tokens - new String accessToken = returnedToken.getAccessToken(); String refreshToken = returnedToken.getRefreshToken(); // Set the properties file Properties prop = new Properties(); prop.setProperty("clientId", txtClientId.getText()); prop.setProperty("clientSecret", txtClientSecret.getText()); prop.setProperty("accessToken", accessToken); prop.setProperty("refreshToken", refreshToken); String tmpFilePath = txtStorePropFilePath.getText(); String pathSeparator = System.getProperty("path.separator"); String suffix = tmpFilePath.endsWith(pathSeparator) ? "bk.properties" : pathSeparator + "bk.properties"; tmpFilePath += suffix; // if ((tmpFilePath.endsWith("\\"))||(tmpFilePath.endsWith("/"))){ // tmpFilePath=tmpFilePath+"bk.properties"; // }else{ // tmpFilePath=tmpFilePath+"/bk.properties"; // } prop.store(new FileOutputStream(new File(tmpFilePath), false), null); // Show ok dialog JOptionPane.showMessageDialog(null, "File generated successfully!"); // ResetField and button btnChooseFile.setEnabled(true); btnGenPropFile.setEnabled(false); btnGetAuthCode.setEnabled(true); txtAuthCode.setText(""); txtAuthCode.setEditable(false); txtClientId.setEditable(true); txtClientSecret.setEditable(true); } catch (IOException e1) { // TODO Auto-generated catch block // e1.printStackTrace(); } } } }); btnGenPropFile.setBounds(660, 169, 186, 45); frmCalendarpropgenerator.getContentPane().add(btnGenPropFile); btnGetAuthCode = new JButton("Get Auth Code"); btnGetAuthCode.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if ((txtClientId.getText().isEmpty()) || (txtClientSecret.getText().isEmpty()) || (txtStorePropFilePath.getText().isEmpty())) { JOptionPane.showMessageDialog(null, "All fields are required to proceed."); } else { btnChooseFile.setEnabled(false); btnGetAuthCode.setEnabled(false); txtClientId.setEditable(false); txtClientSecret.setEditable(false); HttpTransport httpTransport = new NetHttpTransport(); JacksonFactory jsonFactory = new JacksonFactory(); // The clientId and clientSecret are copied from the API Access tab on // the Google APIs Console // Or your redirect URL for web based applications. String redirectUrl = "urn:ietf:wg:oauth:2.0:oob"; String scope = "https://www.googleapis.com/auth/calendar"; try { // Step 1: Authorize --> String authorizationUrl = new GoogleAuthorizationRequestUrl(txtClientId.getText(), redirectUrl, scope) .build(); // Point or redirect your user to the authorizationUrl. console.setText("Go to the following link in your browser:\n " + authorizationUrl); txtAuthCode.setEditable(true); btnGenPropFile.setEnabled(true); } catch (Exception ex) { // TODO: handle exception } } } }); btnGetAuthCode.setBounds(660, 83, 121, 43); frmCalendarpropgenerator.getContentPane().add(btnGetAuthCode); JLabel lblStorePropertiesFile = new JLabel("Store properties file path:"); lblStorePropertiesFile.setBounds(45, 28, 186, 14); frmCalendarpropgenerator.getContentPane().add(lblStorePropertiesFile); txtStorePropFilePath = new JTextField(); txtStorePropFilePath.setEditable(false); txtStorePropFilePath.setBounds(202, 25, 410, 20); frmCalendarpropgenerator.getContentPane().add(txtStorePropFilePath); txtStorePropFilePath.setColumns(10); btnChooseFile = new JButton("Browse"); btnChooseFile.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.showOpenDialog(null); if (chooser.getSelectedFile() != null) { File f = chooser.getSelectedFile(); txtStorePropFilePath.setText(f.getAbsolutePath()); } } }); btnChooseFile.setBounds(660, 24, 91, 23); frmCalendarpropgenerator.getContentPane().add(btnChooseFile); }
/** Create the panel. */ public LC3View() { setLayout(null); JPanel panel = new JPanel(); panel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); panel.setBounds(31, 29, 192, 229); add(panel); panel.setLayout(null); r0 = new JTextField(); r0.setHorizontalAlignment(SwingConstants.CENTER); r0.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); r0.setEditable(false); r0.setFocusable(false); r0.setBounds(46, 10, 70, 26); panel.add(r0); r0.setColumns(10); JLabel lblR = new JLabel("R0"); lblR.setFocusable(false); lblR.setBounds(21, 16, 25, 16); panel.add(lblR); r2 = new JTextField(); r2.setHorizontalAlignment(SwingConstants.CENTER); r2.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); r2.setEditable(false); r2.setFocusable(false); r2.setColumns(10); r2.setBounds(46, 62, 70, 26); panel.add(r2); JLabel lblR_2 = new JLabel("R2"); lblR_2.setFocusable(false); lblR_2.setBounds(21, 68, 25, 16); panel.add(lblR_2); r1 = new JTextField(); r1.setHorizontalAlignment(SwingConstants.CENTER); r1.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); r1.setEditable(false); r1.setFocusable(false); r1.setColumns(10); r1.setBounds(46, 36, 70, 26); panel.add(r1); JLabel lblR_1 = new JLabel("R1"); lblR_1.setFocusable(false); lblR_1.setBounds(21, 42, 25, 16); panel.add(lblR_1); r3 = new JTextField(); r3.setHorizontalAlignment(SwingConstants.CENTER); r3.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); r3.setEditable(false); r3.setFocusable(false); r3.setColumns(10); r3.setBounds(46, 88, 70, 26); panel.add(r3); JLabel lblR_3 = new JLabel("R3"); lblR_3.setFocusable(false); lblR_3.setBounds(21, 94, 25, 16); panel.add(lblR_3); r4 = new JTextField(); r4.setHorizontalAlignment(SwingConstants.CENTER); r4.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); r4.setEditable(false); r4.setFocusable(false); r4.setColumns(10); r4.setBounds(46, 114, 70, 26); panel.add(r4); JLabel lblR_4 = new JLabel("R4"); lblR_4.setFocusable(false); lblR_4.setBounds(21, 120, 25, 16); panel.add(lblR_4); r5 = new JTextField(); r5.setHorizontalAlignment(SwingConstants.CENTER); r5.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); r5.setEditable(false); r5.setFocusable(false); r5.setColumns(10); r5.setBounds(46, 140, 70, 26); panel.add(r5); JLabel lblR_5 = new JLabel("R5"); lblR_5.setFocusable(false); lblR_5.setBounds(21, 146, 25, 16); panel.add(lblR_5); r6 = new JTextField(); r6.setHorizontalAlignment(SwingConstants.CENTER); r6.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); r6.setEditable(false); r6.setFocusable(false); r6.setColumns(10); r6.setBounds(46, 166, 70, 26); panel.add(r6); JLabel lblR_6 = new JLabel("R6"); lblR_6.setFocusable(false); lblR_6.setBounds(21, 172, 25, 16); panel.add(lblR_6); r7 = new JTextField(); r7.setHorizontalAlignment(SwingConstants.CENTER); r7.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); r7.setEditable(false); r7.setFocusable(false); r7.setColumns(10); r7.setBounds(46, 192, 70, 26); panel.add(r7); JLabel lblR_7 = new JLabel("R7"); lblR_7.setFocusable(false); lblR_7.setBounds(21, 198, 25, 16); panel.add(lblR_7); d0 = new JTextField(); d0.setText("0"); d0.setHorizontalAlignment(SwingConstants.RIGHT); d0.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); d0.setFocusable(false); d0.setEditable(false); d0.setColumns(10); d0.setBounds(118, 10, 62, 26); panel.add(d0); d1 = new JTextField(); d1.setText("0"); d1.setHorizontalAlignment(SwingConstants.RIGHT); d1.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); d1.setFocusable(false); d1.setEditable(false); d1.setColumns(10); d1.setBounds(118, 36, 62, 26); panel.add(d1); d2 = new JTextField(); d2.setText("0"); d2.setHorizontalAlignment(SwingConstants.RIGHT); d2.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); d2.setFocusable(false); d2.setEditable(false); d2.setColumns(10); d2.setBounds(118, 62, 62, 26); panel.add(d2); d3 = new JTextField(); d3.setText("0"); d3.setHorizontalAlignment(SwingConstants.RIGHT); d3.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); d3.setFocusable(false); d3.setEditable(false); d3.setColumns(10); d3.setBounds(118, 88, 62, 26); panel.add(d3); d4 = new JTextField(); d4.setText("0"); d4.setHorizontalAlignment(SwingConstants.RIGHT); d4.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); d4.setFocusable(false); d4.setEditable(false); d4.setColumns(10); d4.setBounds(118, 114, 62, 26); panel.add(d4); d5 = new JTextField(); d5.setText("0"); d5.setHorizontalAlignment(SwingConstants.RIGHT); d5.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); d5.setFocusable(false); d5.setEditable(false); d5.setColumns(10); d5.setBounds(118, 140, 62, 26); panel.add(d5); d6 = new JTextField(); d6.setText("0"); d6.setHorizontalAlignment(SwingConstants.RIGHT); d6.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); d6.setFocusable(false); d6.setEditable(false); d6.setColumns(10); d6.setBounds(118, 166, 62, 26); panel.add(d6); d7 = new JTextField(); d7.setText("0"); d7.setHorizontalAlignment(SwingConstants.RIGHT); d7.setFont(new Font("Lucida Grande", Font.PLAIN, 13)); d7.setFocusable(false); d7.setEditable(false); d7.setColumns(10); d7.setBounds(118, 192, 62, 26); panel.add(d7); JButton btnReset = new JButton("Reset"); btnReset.setFocusable(false); btnReset.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { machine.reset(); console.setText(""); update(); } }); btnReset.setBounds(55, 369, 99, 29); add(btnReset); btnStep = new JButton("Step"); btnStep.setFocusable(false); btnStep.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { machine.step(); update(); } }); btnStep.setBounds(9, 400, 99, 29); add(btnStep); btnStepOver = new JButton("Step Over"); btnStepOver.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { status.setText("running..."); memView.select(0, 0); btnStep.setEnabled(false); btnStepOver.setEnabled(false); btnRun.setEnabled(false); btnStop.setEnabled(true); machine.stepOver(); } }); btnStepOver.setBounds(104, 400, 92, 29); add(btnStepOver); btnRun = new JButton("Run"); btnRun.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { status.setText("running..."); memView.select(0, 0); btnStep.setEnabled(false); btnStepOver.setEnabled(false); btnRun.setEnabled(false); btnStop.setEnabled(true); machine.run(); } }); btnRun.setBounds(9, 432, 99, 29); add(btnRun); btnStop = new JButton("Stop"); btnStop.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { machine.stop(); } }); btnStop.setBounds(104, 432, 99, 29); add(btnStop); JScrollPane memScroll = new JScrollPane(); memScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); memScroll.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); memScroll.setBounds(235, 29, 421, 485); add(memScroll); memView = new JTextArea(); memView.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (e.getClickCount() == 2) { int line = getLine(memView.getText(), memView.getCaretPosition()); machine.toggleBreakPnt(line); } update(); } }); memView.setEditable(false); memView.setFont(new Font("Courier New", Font.PLAIN, 13)); memScroll.setViewportView(memView); JLabel lblStatus = new JLabel("Status:"); lblStatus.setBounds(17, 541, 50, 16); add(lblStatus); status = new JTextField(); status.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); status.setBounds(67, 536, 589, 26); add(status); status.setColumns(10); JPanel panel_1 = new JPanel(); panel_1.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); panel_1.setBounds(31, 270, 123, 71); add(panel_1); panel_1.setLayout(null); cbNeg = new JCheckBox("Neg"); cbNeg.setFocusable(false); cbNeg.setBounds(28, 6, 57, 23); panel_1.add(cbNeg); cbZero = new JCheckBox("Zero"); cbZero.setFocusable(false); cbZero.setSelected(true); cbZero.setBounds(28, 25, 60, 23); panel_1.add(cbZero); cbPos = new JCheckBox("Pos"); cbPos.setFocusable(false); cbPos.setBounds(28, 43, 54, 23); panel_1.add(cbPos); JButton btnLoadProgram = new JButton("Load Program"); btnLoadProgram.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); if (currentDir != null) fileChooser.setCurrentDirectory(currentDir); fileChooser.setFileFilter( new FileNameExtensionFilter("Prolog Files", new String[] {"lc3"})); if (fileChooser.showOpenDialog(memView) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { machine.loadProgram(file.getAbsolutePath()); update(); JFrame frame = (JFrame) memView .getParent() .getParent() .getParent() .getParent() .getParent() .getParent() .getParent(); frame.setTitle("LC3 Simulator " + machine.programName()); currentDir = file.getParentFile(); } catch (Exception error) { } } } }); btnLoadProgram.setBounds(48, 473, 117, 29); add(btnLoadProgram); console = new JTextArea(); console.addMouseListener( new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { memView.setCaretPosition(console.getText().length()); } }); console.addKeyListener( new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); e.consume(); machine.consoleNewChar(c); } @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == '\n') e.consume(); } }); console.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); console.setBounds(69, 574, 589, 145); add(console); JLabel lblConsole = new JLabel("Console:"); lblConsole.setBounds(9, 574, 58, 16); add(lblConsole); machine = new LC3(this); update(); }
/** * Initialize the contents of the frame. * * @throws SQLException */ private void initialize() throws SQLException { frame = new JFrame(); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); txtMoviename = new JTextField(); txtMoviename.setEditable(false); txtMoviename.setForeground(Color.BLACK); txtMoviename.setBackground(Color.LIGHT_GRAY); txtMoviename.setText( QueryInputAndOutput.getString( connection, "select name from movie where movieid=" + MovieID, "NAME")); // txtMoviename.setText("movie name"); txtMoviename.setBounds(112, 10, 312, 30); frame.getContentPane().add(txtMoviename); txtMoviename.setColumns(10); JEditorPane dtrpnConext = new JEditorPane(); dtrpnConext.setText("Comments:"); dtrpnConext.setBounds(10, 50, 106, 21); frame.getContentPane().add(dtrpnConext); JLabel lblMovieName = new JLabel("Movie Name"); lblMovieName.setBounds(10, 10, 77, 30); frame.getContentPane().add(lblMovieName); final JTextArea txtrYourComments = new JTextArea(); txtrYourComments.setBackground(Color.LIGHT_GRAY); txtrYourComments.setText("your comments"); txtrYourComments.setBounds(10, 81, 414, 108); frame.getContentPane().add(txtrYourComments); final JRadioButton rdbtnNewRadioButton = new JRadioButton("like it"); buttonGroup.add(rdbtnNewRadioButton); rdbtnNewRadioButton.setBounds(10, 201, 121, 23); frame.getContentPane().add(rdbtnNewRadioButton); final JRadioButton rdbtnSuckIt = new JRadioButton("don't like it"); buttonGroup.add(rdbtnSuckIt); rdbtnSuckIt.setBounds(10, 229, 121, 23); frame.getContentPane().add(rdbtnSuckIt); JButton btnSubmit = new JButton("Submit"); btnSubmit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { // get the comments. String movieName = txtMoviename.getText(); String content = txtrYourComments.getText(); boolean LikeOrNot; if (rdbtnNewRadioButton.isSelected()) { LikeOrNot = true; // true stands for like } else LikeOrNot = false; // false stands for dislike System.out.println("movie=" + movieName); System.out.println("movie content=" + content); System.out.println("like=" + LikeOrNot); // call function ** to sumbit try { Logic.SubmitComments( connection, Main.UserID, Main.MovieID, content, LikeOrNot, Main.CommentID); Main.content = content; if (LikeOrNot) Main.likes += 1; else Main.dislikes += 1; Main.refresh(); frame.dispose(); // JFrame.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } // refresh Main window } }); btnSubmit.setBounds(271, 229, 93, 23); frame.getContentPane().add(btnSubmit); }
public TemperatureDialog() { super(MainFrame.instance(), "编辑温度", true); setLayout(null); setSize(420, 420); setLocationRelativeTo(null); temperatureDialog = this; JLabel jlbName = new JLabel("温度内容(100字):"); JButton ensure = new JButton("确定"); JButton cancel = new JButton("取消"); jTextArea = new JTextArea(); jlbName.setBounds(60, 30, 300, 30); jTextArea.setBounds(60, 60, 300, 50); jTextArea.setAutoscrolls(true); jTextArea.setWrapStyleWord(true); jTextArea.setLineWrap(true); ensure.setBounds(115, 320, 70, 40); cancel.setBounds(210, 320, 70, 40); ensure.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { String content = jTextArea.getText().trim(); if (content.isEmpty()) { JOptionPane.showMessageDialog(null, "请输入内容", "提示", JOptionPane.OK_OPTION); return; } if (content.length() > 100) { JOptionPane.showMessageDialog(null, "内容不能超过100个字符", "提示", JOptionPane.OK_OPTION); return; } TemperatureDialog.instance().dispose(); List<Temperature> tList = TemperatureDao.instance().gettemperatureList(); if (tList == null || tList.size() < 1) { System.err.println( "TemperatureDao.instance().gettemperatureList() 为 null 或者 size 为 0"); } Temperature t = tList.get(0); t.content = content; BusyDialog bd = new BusyDialog(); ExecutorService executor = Executors.newCachedThreadPool(); CountDownLatch latch = new CountDownLatch(1); TemperatureWorker w1 = new TemperatureWorker(latch, "TemperatureWorker"); LodingWorker loading = new LodingWorker(latch, bd); executor.execute(w1); executor.execute(loading); executor.shutdown(); } }); cancel.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { TemperatureDialog.instance().dispose(); // TemperatureDialog.instance().jTextArea.setText(""); } }); add(jlbName); add(jTextArea); add(ensure); add(cancel); }
public OperatorGUI(OperatorAgent a) { myAgent = a; setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 200, 416, 323); contentPane = new JPanel(); // contentPane.setBorder((5, 100, 5, 5)); contentPane.setBounds(100, 200, 100, 100); setContentPane(contentPane); contentPane.setLayout(null); // textAreaSeller = new JTextArea(); // textAreaSeller.setBounds(33, 0, 348, 106); // contentPane.add(textAreaSeller); textThing = new JTextField(); textThing.setBounds(282, 158, 114, 19); contentPane.add(textThing); textThing.setText("d"); textThing.setColumns(10); textField_1 = new JTextField(); textField_1.setBounds(282, 189, 114, 19); contentPane.add(textField_1); textField_1.setText("3"); textField_1.setColumns(10); textField_2 = new JTextField(); textField_2.setBounds(282, 220, 114, 19); contentPane.add(textField_2); textField_2.setText("20000"); textField_2.setColumns(10); // textField_2.setVisible(false); JLabel lblThing = new JLabel("Thing"); lblThing.setBounds(179, 158, 70, 15); contentPane.add(lblThing); JLabel textPrice = new JLabel("Price"); textPrice.setBounds(179, 189, 70, 15); contentPane.add(textPrice); JLabel textDeadline = new JLabel("Deadline"); // textDeadline.setVisible(false); textDeadline.setBounds(179, 222, 70, 15); contentPane.add(textDeadline); JButton btnSend = new JButton("Send"); btnSend.setBounds(282, 245, 117, 25); contentPane.add(btnSend); btnSend.setAction(sendAction); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setBounds(36, 12, 348, 136); contentPane.add(scrollPane_1); JPanel panel_1 = new JPanel(); scrollPane_1.setViewportView(panel_1); panel_1.setLayout(new BorderLayout(0, 0)); textAreaOperator = new JTextArea(); panel_1.add(textAreaOperator); textAreaOperator.setBounds(33, 80, 293, 156); // textAreaSeller.setTabSize(30); // textAreaSeller.setRows(50); this.setTitle(myAgent.getName()); }
/** * Component initialization. * * @throws java.lang.Exception */ private void jbInit() throws Exception { contentPane = (JPanel) getContentPane(); contentPane.setLayout(null); this.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); setSize(new Dimension(400, 621)); setTitle("实时通讯模块测试程序"); jButton1.setBounds(new Rectangle(11, 412, 82, 26)); jButton1.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton1.setText("召测接口"); jButton1.addActionListener(new RealTimeTestFrame_jButton1_actionAdapter(this)); jButton2.setBounds(new Rectangle(10, 366, 83, 26)); jButton2.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton2.setText("创建对象"); jButton2.addActionListener(new RealTimeTestFrame_jButton2_actionAdapter(this)); jLabel1.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel1.setText("接入IP:"); jLabel1.setBounds(new Rectangle(23, 22, 63, 16)); jLabel2.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel2.setText("接入端口:"); jLabel2.setBounds(new Rectangle(23, 67, 63, 16)); jTextField1.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jTextField1.setText("172.19.74.13"); txt_port.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_port.setText("3000"); txt_port.setBounds(new Rectangle(84, 64, 88, 22)); jLabel3.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel3.setText("AppID:"); jLabel3.setBounds(new Rectangle(23, 113, 63, 16)); contentPane.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel4.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel4.setText("ZDLJDZ:"); jLabel4.setBounds(new Rectangle(23, 158, 63, 16)); jLabel5.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel5.setText("规约号:"); jLabel5.setBounds(new Rectangle(23, 186, 63, 16)); jLabel6.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel6.setText("发送内容:"); jLabel6.setBounds(new Rectangle(23, 333, 63, 16)); jLabel7.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel7.setText("通讯方式:"); jLabel7.setBounds(new Rectangle(21, 219, 63, 16)); txt_AppID.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_AppID.setText("25"); txt_AppID.setBounds(new Rectangle(84, 110, 83, 22)); txt_zdljdz.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_zdljdz.setText("91010022"); txt_zdljdz.setBounds(new Rectangle(84, 155, 88, 22)); txt_gyh.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_gyh.setText("100"); txt_gyh.setBounds(new Rectangle(84, 183, 63, 22)); txt_txfs.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_txfs.setText("40"); txt_txfs.setBounds(new Rectangle(84, 218, 63, 22)); jTextField7.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_ip.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); InetAddress localhost = java.net.InetAddress.getLocalHost(); String hostIP = localhost.getHostAddress(); txt_ip.setText(hostIP); txt_ip.setBounds(new Rectangle(84, 19, 159, 22)); txt_content.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_content.setText("6000000100111107"); txt_content.setBounds(new Rectangle(84, 330, 298, 22)); txt_content.addActionListener(new RealTimeTestFrame_txt_content_actionAdapter(this)); jButton3.setBounds(new Rectangle(200, 412, 89, 26)); jButton3.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton3.setText("发送短信"); jButton3.addActionListener(new RealTimeTestFrame_jButton3_actionAdapter(this)); jButton4.setBounds(new Rectangle(295, 366, 96, 26)); jButton4.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton4.setText("自定义命令"); jButton4.addActionListener(new RealTimeTestFrame_jButton4_actionAdapter(this)); lab_yxj.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); lab_yxj.setText("优先级:"); lab_yxj.setBounds(new Rectangle(23, 287, 61, 16)); txt_gnm.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_gnm.setText("0D"); txt_gnm.setBounds(new Rectangle(84, 251, 63, 22)); jLabel9.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel9.setText("手机号码:"); jLabel9.setBounds(new Rectangle(190, 67, 67, 16)); txt_sjhm.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_sjhm.setText("13800571505"); txt_sjhm.setBounds(new Rectangle(250, 64, 111, 22)); jLabel10.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel10.setText("命令序号:"); jLabel10.setBounds(new Rectangle(190, 112, 73, 16)); txt_mlxh.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_mlxh.setText("1"); txt_mlxh.setBounds(new Rectangle(250, 109, 110, 22)); jButton5.setBounds(new Rectangle(105, 366, 83, 26)); jButton5.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton5.setText("连接"); jButton5.addActionListener(new RealTimeTestFrame_jButton5_actionAdapter(this)); jButton6.setBounds(new Rectangle(200, 366, 83, 26)); jButton6.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton6.setText("断开连接"); jButton6.addActionListener(new RealTimeTestFrame_jButton6_actionAdapter(this)); jLabel11.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel11.setText("终端逻辑地址:"); jLabel11.setBounds(new Rectangle(164, 199, 87, 16)); txt_listterminal.setText("12041234"); txt_listterminal.setBounds(new Rectangle(252, 196, 130, 22)); jButton8.setBounds(new Rectangle(170, 248, 90, 26)); jButton8.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton8.setText("加入队列"); jButton8.addActionListener(new RealTimeTestFrame_jButton8_actionAdapter(this)); jButton9.setBounds(new Rectangle(283, 248, 85, 26)); jButton9.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton9.setText("在线状态"); jButton9.addActionListener(new RealTimeTestFrame_jButton9_actionAdapter(this)); memo1.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); memo1.setToolTipText(""); memo1.setEditable(false); memo1.setLineWrap(true); memo1.setWrapStyleWord(true); memo1.setBounds(new Rectangle(17, 451, 361, 154)); jButton7.setBounds(new Rectangle(226, 289, 92, 26)); jButton7.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton7.setText("设置掉线"); jButton7.addActionListener(new RealTimeTestFrame_jButton7_actionAdapter(this)); jButton10.setBounds(new Rectangle(192, 155, 90, 23)); jButton10.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton10.setText("手工建档"); jButton10.addActionListener(new RealTimeTestFrame_jButton10_actionAdapter(this)); jLabel12.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jLabel12.setText("功能码:"); jLabel12.setBounds(new Rectangle(23, 254, 61, 16)); txt_yxj.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); txt_yxj.setText("08"); txt_yxj.setBounds(new Rectangle(84, 283, 63, 22)); jButton11.setBounds(new Rectangle(105, 412, 82, 26)); jButton11.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton11.setActionCommand(""); jButton11.setText("获取结果"); jButton11.addActionListener(new RealTimeTestFrame_jButton11_actionAdapter(this)); jButton12.setBounds(new Rectangle(301, 412, 87, 26)); jButton12.setFont(new java.awt.Font("宋体", Font.PLAIN, 12)); jButton12.setText("批量测试"); jButton12.addActionListener(new RealTimeTestFrame_jButton12_actionAdapter(this)); contentPane.add(jLabel1); contentPane.add(jLabel2); contentPane.add(txt_port); contentPane.add(jLabel3); contentPane.add(jLabel4); contentPane.add(jTextField1); contentPane.add(txt_AppID); contentPane.add(txt_zdljdz); contentPane.add(jTextField7); contentPane.add(txt_ip); contentPane.add(txt_content); contentPane.add(jLabel6); contentPane.add(jLabel9); contentPane.add(txt_sjhm); contentPane.add(jLabel10); contentPane.add(txt_mlxh); contentPane.add(txt_listterminal); contentPane.add(jLabel11); contentPane.add(jButton8); contentPane.add(jButton9); contentPane.add(memo1); contentPane.add(jButton7); contentPane.add(jButton10); contentPane.add(txt_gnm); contentPane.add(txt_txfs); contentPane.add(txt_gyh); contentPane.add(jLabel5); contentPane.add(jLabel7); contentPane.add(jLabel12); contentPane.add(lab_yxj); contentPane.add(txt_yxj); contentPane.add(jButton2); contentPane.add(jButton5); contentPane.add(jButton6); contentPane.add(jButton4); contentPane.add(jButton1); contentPane.add(jButton11); contentPane.add(jButton3); contentPane.add(jButton12); }
/** Create the frame. */ public Captter() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); SwingUtilities.updateComponentTreeUI(this); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { } setAlwaysOnTop(true); setTitle("Captter created by tao"); Config config = new Config(); config.loadTwitter(); config.loadConfig(); String[] twitterAccess = config.getTwitter(); String CK = twitterAccess[0]; String CS = twitterAccess[1]; String AT = twitterAccess[2]; String ATS = twitterAccess[3]; Configuration jconf = new ConfigurationBuilder().setOAuthConsumerKey(CK).setOAuthConsumerSecret(CS).build(); AccessToken token = new AccessToken(AT, ATS); twitter = new TwitterFactory(jconf).getInstance(token); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(120, 120, 420, 240); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); tweet = new JButton("Tweet(Ctrl+Enter)"); tweet.setBounds(260, 168, 140, 30); tweet.addActionListener(this); contentPane.add(tweet); textArea.setBounds(0, 0, 400, 130); textArea.setFont(new Font("メイリオ", Font.BOLD, 20)); textArea.setLineWrap(true); contentPane.add(textArea); textField = new HintTextField(); textField.setBounds(0, 140, 400, 28); textField.setFont(new Font("メイリオ", Font.PLAIN, 12)); textField.setHint("固定テキスト"); contentPane.add(textField); JSeparator separator = new JSeparator(); separator.setBounds(0, 130, 400, 10); contentPane.add(separator); imageField = new JLabel(""); imageField.setBounds(0, 0, 400, 130); contentPane.add(imageField); settings = new JButton("設定"); settings.setBounds(0, 169, 70, 30); settings.addActionListener(this); contentPane.add(settings); convert = new JCheckBox("convert 16:9"); convert.setSelected(true); convert.setBounds(70, 170, 111, 23); contentPane.add(convert); Quick = new JCheckBox("Quick"); Quick.setBounds(185, 170, 70, 23); contentPane.add(Quick); textArea.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { keyPress(e); } }); addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Config config = new Config(); config.loadConfig(); boolean[] removes = config.getRemoves(); if (removes[0]) { File convertedDir = new File( new File(System.getProperty("java.class.path")).getParent() + "/converted/"); String conDirPath = convertedDir.getPath(); String[] convertedFiles = convertedDir.list(); for (String s : convertedFiles) { if (s.endsWith(".png")) new File(conDirPath + "/" + s).delete(); } } if (removes[1]) { File captureDir = new File(config.getTargetDir()); String capDirPath = captureDir.getPath(); String[] captureFiles = captureDir.list(); for (String s : captureFiles) { if (s.endsWith(".jpg") || s.endsWith(".png") || s.endsWith(".bmp")) new File(capDirPath + "/" + s).delete(); } } } }); AutoChecker ac = new AutoChecker(new File(config.getTargetDir())); ac.start(new File(config.getTargetDir())); }
/** * Creates new form UTalkingUI * * @param userName */ public UTalkingUI(String userName, UIManager p) { initComponents(); this.userName = userName; pm = p; setTitle("Talk to " + userName); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int ww = (int) (screenSize.width * 0.9); int wh = (int) (screenSize.height * 0.9); setBounds((int) (ww * 0.2), (int) (wh * 0.2), (int) (ww * 0.6), (int) (wh * 0.6)); jTextPane1 = new JTextPane(); jTextArea1 = new JTextArea(); jButton1 = new JButton(); jButton2 = new JButton(); jTextPane1.setBounds(0, 0, getWidth(), getHeight() * 7 / 11 - 10); jTextPane1.setEditable(false); jTextPane1.setToolTipText("消息"); jTextArea1.setBounds(0, getHeight() * 7 / 11, getWidth(), getHeight() * 2 / 11 - 3); jTextArea1.setToolTipText("发送"); jButton1.setBounds(getWidth() - 220, getHeight() * 9 / 11 + 10, 100, 30); jButton1.setText("发送"); jButton1.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent me) { if (jTextArea1.getText().length() > 0) { pm.getManager() .getInterchange() .sendMsgToUser(userName, jTextArea1.getText()); // /////发送消息 jTextPane1.setText( jTextPane1.getText() + "\n" + pm.getManager().getData().getUserName() + " :\n" + jTextArea1.getText()); jTextArea1.setText(""); } } @Override public void mousePressed(MouseEvent me) {} @Override public void mouseReleased(MouseEvent me) {} @Override public void mouseEntered(MouseEvent me) {} @Override public void mouseExited(MouseEvent me) {} }); jButton2.setBounds(getWidth() - 110, getHeight() * 9 / 11 + 10, 100, 30); jButton2.setText("退出"); jButton2.addMouseListener( new MouseListener() { @Override public void mouseClicked(MouseEvent me) { dispose(); } @Override public void mousePressed(MouseEvent me) {} @Override public void mouseReleased(MouseEvent me) {} @Override public void mouseEntered(MouseEvent me) {} @Override public void mouseExited(MouseEvent me) {} }); jTextArea1.addKeyListener( new KeyListener() { @Override public void keyTyped(KeyEvent ke) { if (ke.getKeyChar() == 10) // 发送 System.out.println("hehe"); } @Override public void keyPressed(KeyEvent ke) {} @Override public void keyReleased(KeyEvent ke) {} }); add(jTextArea1); add(jTextPane1); add(jButton1); add(jButton2); setVisible(true); }