/** Sets the properties of the JFrame adds and initializes the GUI components */ public StartPage() { super("Tetris"); setSize(400, 400); this.setDefaultCloseOperation(EXIT_ON_CLOSE); getContentPane().setBackground(Color.GREEN); titleLable = new JLabel("Tetris!!!"); titleLable.setFont(new Font("Times New Roman", Font.BOLD, 40)); titleLable.setBounds(130, 90, 400, 40); authorLabel = new JLabel("by: Hao Wei"); authorLabel.setFont(new Font("Times New Roman", Font.BOLD, 20)); authorLabel.setBounds(140, 130, 300, 40); playButton = new JButton("Play"); playButton.addActionListener(this); playButton.setBounds(120, 200, 150, 25); highscoresButton = new JButton("view highscores"); highscoresButton.addActionListener(this); highscoresButton.setBounds(120, 230, 150, 25); setLayout(null); add(titleLable); add(authorLabel); add(playButton); add(highscoresButton); setVisible(true); } // end constructor method
public ComSetting() { setLayout(null); JLabel ComLabel = new JLabel(Param.Label_Com_Port); ComLabel.setBounds(10, 10, 100, 20); add(ComLabel); comPortList = new JComboBox<String>(); updateComList(); comPortList.setPreferredSize(new Dimension(100, 20)); comPortList.setBounds(120, 10, 100, 20); add(comPortList); JButton ComButton = new JButton(Param.Label_Com_Update); ComButton.setBounds(240, 10, 100, 20); ComButton.addActionListener(this); add(ComButton); JLabel BaudLabel = new JLabel(Param.Label_Baud); BaudLabel.setBounds(10, 40, 100, 20); add(BaudLabel); Integer[] baud = {9600, 115200}; comBaudList = new JComboBox<Integer>(baud); comBaudList.setBounds(120, 40, 100, 20); add(comBaudList); }
public void addComponents() { imageLabel.setBounds(0, -40, 450, 423); textLabel.setBounds(0, 260, 450, 35); add(imageLabel); add(textLabel); }
private void paintSprites(List<Sprite> sprites) { if (sprites != null) { for (int i = 0; i < sprites.size(); i++) { // get all sprites with getresource URL imagePath = this.getClass().getResource(sprites.get(i).getImageName().toString()); ImageIcon icon = new ImageIcon(imagePath); JLabel picLabel = new JLabel(icon); picLabel.setBounds( sprites.get(i).getX(), sprites.get(i).getY(), icon.getIconWidth(), icon.getIconHeight()); this.add(picLabel); } ImageIcon bgImageIcon = new ImageIcon(this.getClass().getResource(controller.getGameModel().getBkgURL())); Image reImage = bgImageIcon.getImage(); reImage = reImage.getScaledInstance( Dimensions.GAME_MAKER_RIGHT_PANEL_WIDTH, Dimensions.GAME_MAKER_RIGHT_PANEL_HEIGHT, Image.SCALE_SMOOTH); bgImageIcon = new ImageIcon(reImage); JLabel bkgImageLabel = new JLabel(bgImageIcon); bkgImageLabel.setBounds( 0, Dimensions.GAME_MAKER_RIGHT_PANEL_Y, Dimensions.GAME_MAKER_RIGHT_PANEL_WIDTH, Dimensions.GAME_MAKER_RIGHT_PANEL_HEIGHT); this.add(bkgImageLabel); } }
/** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { formLabel = new JLabel(); formLabel.setBounds(new Rectangle(25, 140, 120, 15)); formLabel.setText("Included in form(s): "); questionLabel = new JLabel(); questionLabel.setBounds(new Rectangle(25, 110, 120, 15)); questionLabel.setText("Question: "); typeLabel = new JLabel(); typeLabel.setBounds(new Rectangle(25, 80, 120, 15)); typeLabel.setText("Type: "); dateLabel = new JLabel(); dateLabel.setBounds(new Rectangle(25, 50, 120, 15)); dateLabel.setText("Creation Date: "); codeLabel = new JLabel(); codeLabel.setBounds(new Rectangle(25, 20, 120, 15)); codeLabel.setText("Code: "); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.add(codeLabel, null); jContentPane.add(dateLabel, null); jContentPane.add(typeLabel, null); jContentPane.add(questionLabel, null); jContentPane.add(getCodeTextField(), null); jContentPane.add(getDateTextField(), null); jContentPane.add(getTypeTextField(), null); jContentPane.add(getQuestionTextField(), null); jContentPane.add(formLabel, null); jContentPane.add(getFormTextField(), null); jContentPane.add(getViewButton(), null); jContentPane.add(getDeleteButton(), null); } return jContentPane; }
public OpponentFrame(final Server ss) { thiss = this; this.server = ss; update = new Timer(); setResizable(false); setTitle("player list - Sinius Chess"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 249, 323); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); list = new JList<String>(); list.setValueIsAdjusting(true); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); update.schedule( new TimerTask() { @Override public void run() { list.setListData(server.getOnlinePlayers()); } }, 1, 3000); list.setBounds(10, 62, 221, 189); contentPane.add(list); JLabel lblConnectedTo = new JLabel("Connected to " + server.ip + ":" + server.port); lblConnectedTo.setBounds(10, 12, 221, 14); contentPane.add(lblConnectedTo); JLabel lblOnlinePlayers = new JLabel("online players:"); lblOnlinePlayers.setBounds(10, 37, 96, 14); contentPane.add(lblOnlinePlayers); JButton btnChalange = new JButton("Chalange Player"); btnChalange.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (list.getSelectedValue() == null) { JOptionPane.showMessageDialog( thiss, "Select an opponent", "No opponent selected", JOptionPane.ERROR_MESSAGE); return; } if (list.getSelectedValue().equals(ss.myName)) { JOptionPane.showMessageDialog( thiss, "Cannot play against yourself", "chose an other opponent", JOptionPane.ERROR_MESSAGE); return; } server.sendMessage( new Message("client" + server.id, "match_request", list.getSelectedValue())); } }); btnChalange.setBounds(10, 263, 221, 23); contentPane.add(btnChalange); }
public Welcome() { c.setLayout(null); c.add(welcome); welcome.setBounds(250, 100, 600, 50); welcome.setFont(font1); welcome.setForeground(Color.black); c.add(hotel); hotel.setBounds(350, 170, 700, 50); hotel.setFont(font2); hotel.setForeground(Color.black); c.add(check); check.setBounds(450, 350, 250, 50); check.addActionListener(this); c.add(order); order.setBounds(150, 350, 250, 50); order.addActionListener(this); c.add(bill); bill.setBounds(750, 350, 250, 50); bill.addActionListener(this); c.add(exit); exit.setBounds(40, 600, 130, 20); exit.addActionListener(this); c.add(back).setBounds(0, 0, 1800, 1000); }
/* * Information of the Server */ private static void ServerPanel() { serverpanel.setLayout(null); serverpanel.setBounds(400, 350, 240, 280); serverpanel.setBorder(BorderFactory.createTitledBorder("Server")); // serverpanel.setBackground(Color.WHITE);' JLabel serverLabel = new JLabel("Client: "); clientstatus = new JLabel(ClientStatus); serverLabel.setBounds(10, 20, 40, 20); clientstatus.setBounds(50, 20, 60, 20); serverpanel.add(serverLabel); serverpanel.add(clientstatus); contentPane.add(serverpanel); // Heartbeat Button!! enableHeartbeat = new JRadioButton(); JLabel Heartbeat = new JLabel("Heartbeat"); Heartbeat.setBounds(30, 45, 70, 30); enableHeartbeat.setBounds(10, 45, 20, 30); enableHeartbeat.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JRadioButton radioButton = (JRadioButton) e.getSource(); server.enableHeartbeat = radioButton.isSelected(); System.out.println( "Server heartbeat has been toggled to" + ((radioButton.isSelected()) ? " On" : " Off")); } }); serverpanel.add(Heartbeat); serverpanel.add(enableHeartbeat); }
/** Start view */ private void startView() { InternationalizationCentral iCentral = new InternationalizationCentral(); logManager.trace("Initializing components"); Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); int xPosition = (int) (dimension.getWidth() - 400); frame = new JFormFrame(new Point(xPosition, 0), 400); frame.setInternalSize(300, 200); animeTitleLabel = new JLabel(iCentral.getWord("title")); currentEpisodeLabel = new JLabel(iCentral.getWord("current_episode")); animeTitleField = new JTextField(); currentEpisodeField = new JTextField(); frame.setOkButtonLabel(iCentral.getWord("ok")); frame.setCancelButtonLabel(iCentral.getWord("cancel")); logManager.trace("Setting bounds"); animeTitleLabel.setBounds(10, 20, 150, 25); currentEpisodeLabel.setBounds(10, 60, 150, 25); animeTitleField.setBounds(160, 20, 150, 25); currentEpisodeField.setBounds(160, 60, 50, 25); logManager.trace("Joining components"); frame.addToInternalPanel(animeTitleLabel); frame.addToInternalPanel(currentEpisodeLabel); frame.addToInternalPanel(animeTitleField); frame.addToInternalPanel(currentEpisodeField); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); } // end of the method startView
/** Create the panel. */ public authorJPanel() { setBackground(Color.BLACK); setLayout(null); JLabel lblIot = new JLabel("IOT 13-1"); lblIot.setHorizontalTextPosition(SwingConstants.CENTER); lblIot.setHorizontalAlignment(SwingConstants.CENTER); lblIot.setFont(new Font("SAO UI", Font.BOLD, 51)); lblIot.setForeground(Color.WHITE); lblIot.setBounds(377, 61, 193, 102); add(lblIot); JLabel lblHanShukai = new JLabel(" Han Shukai"); lblHanShukai.setIcon(new ImageIcon(authorJPanel.class.getResource("/image/skills_normal.png"))); lblHanShukai.setForeground(Color.WHITE); lblHanShukai.setFont(new Font("SAO UI", Font.BOLD, 51)); lblHanShukai.setBounds(345, 189, 250, 102); add(lblHanShukai); JLabel label = new JLabel(""); label.setIcon(new ImageIcon(authorJPanel.class.getResource("/image/bniang.jpg"))); label.setForeground(Color.WHITE); label.setFont(new Font("SAO UI", Font.BOLD, 51)); label.setBounds(101, 104, 128, 266); add(label); // JLabel lblGongchen = new JLabel(" GongChen"); // lblGongchen.setIcon(new // ImageIcon(authorJPanel.class.getResource("/image/skills_normal.png"))); // lblGongchen.setForeground(Color.WHITE); // lblGongchen.setFont(new Font("SAO UI", Font.BOLD, 51)); // lblGongchen.setBounds(345, 300, 225, 102); // add(lblGongchen); }
public ReportDisabledParkingSpace() { super(); setTitle("Report Disable Parking Space"); JButton btnCreate = new JButton("Create"); btnCreate.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) {} }); btnCreate.setBounds(148, 207, 89, 23); getContentPane().add(btnCreate); JLabel lblPlace = new JLabel("Place:"); lblPlace.setBounds(79, 44, 46, 14); getContentPane().add(lblPlace); textField = new JTextField(); textField.setBounds(148, 38, 146, 26); getContentPane().add(textField); textField.setColumns(10); JLabel lblReason = new JLabel("Reason:"); lblReason.setBounds(79, 80, 46, 14); getContentPane().add(lblReason); textField_1 = new JTextField(); textField_1.setBounds(148, 74, 146, 26); getContentPane().add(textField_1); textField_1.setColumns(10); }
/** * Position the component of the GUI. * * <p>Currently use absolute positioning to gather most of the component in the top-left corner. */ private void setLayout() { // Set the globe to use the full space available ping_globe.setBounds(0, 0, applet.getWidth(), applet.getHeight()); // First raw of display Dimension name_size = nickname_field.getPreferredSize(); Dimension update_name_size = rename_button.getPreferredSize(); Dimension client_info_size = client_info_display.getPreferredSize(); int row_height = name_size.height; nickname_field.setBounds(5, 5, name_size.width, row_height); rename_button.setBounds(8 + name_size.width, 5, update_name_size.width, row_height); client_info_display.setBounds( 11 + name_size.width + update_name_size.width, 5, client_info_size.width, row_height); // Second raw of display Dimension counter_size = pings_counter_display.getPreferredSize(); Dimension pause_size = pause_button.getMinimumSize(); pings_counter_display.setBounds(5, 8 + row_height, counter_size.width, row_height); pause_button.setBounds(8 + counter_size.width, 8 + row_height, pause_size.width, row_height); }
private void setUpGui() { area = JokemonDriver.Area.Stringville; mouse = new Point(); int thingInt = 0; this.setTitle("Town Map"); this.setSize(195, 239); this.setResizable(false); this.setLayout(null); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.setVisible(false); visible = false; this.setLocationRelativeTo(null); Container cp = this.getContentPane(); JLabel map = new JLabel(); map.setBounds(1, -5, 188, 176); map.setIcon(new ImageIcon(townMap.class.getResource("Logos/townmap.png"))); closeWindow = new JButton(); closeWindow.setText("Close Window"); closeWindow.setBounds(0, 192, 188, 20); areaDisplay = new JLabel(); areaDisplay.setText(area.toString().replace('_', ' ')); areaDisplay.setHorizontalAlignment(JLabel.CENTER); areaDisplay.setBounds(0, 171, 188, 20); addMouseMotionListener(this); closeWindow.addActionListener(this); cp.add(map); cp.add(closeWindow); cp.add(areaDisplay); }
public MapManager(JFrame owner, Boolean model) { super(owner, model); setResizable(false); setTitle("Downloading..."); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setBounds(100, 100, 313, 138); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); progressBar = new JProgressBar(); progressBar.setBounds(10, 63, 278, 22); contentPane.add(progressBar); JLabel lblDownloadingMap = new JLabel("<html><body><center>Downloading map...<br/>Please Wait</center></body></html>"); lblDownloadingMap.setHorizontalAlignment(SwingConstants.CENTER); lblDownloadingMap.setBounds(0, 5, 313, 30); contentPane.add(lblDownloadingMap); label = new JLabel(""); label.setHorizontalAlignment(SwingConstants.CENTER); label.setBounds(0, 42, 313, 14); contentPane.add(label); addWindowListener( new WindowListener() { @Override public void windowOpened(WindowEvent arg0) { MapManagerWorker worker = new MapManagerWorker() { @Override protected void done() { setVisible(false); super.done(); } }; worker.execute(); } @Override public void windowActivated(WindowEvent e) {} @Override public void windowClosed(WindowEvent e) {} @Override public void windowClosing(WindowEvent e) {} @Override public void windowDeactivated(WindowEvent e) {} @Override public void windowDeiconified(WindowEvent e) {} @Override public void windowIconified(WindowEvent e) {} }); }
private void setupPanel() { // setBackground(SystemColor.textHighlight); setLayout(null); // Username Label lblUsername.setBounds(30, 36, 72, 16); lblUsername.setFont(new Font("Lucida Grande", Font.BOLD, 13)); this.add(lblUsername); // Username userNameField.setBounds(107, 30, 149, 28); userNameField.setColumns(10); userNameField.setText("Enter Username"); this.add(userNameField); // Password Label lblPassword.setBounds(30, 69, 72, 16); lblPassword.setFont(new Font("Lucida Grande", Font.BOLD, 13)); this.add(lblPassword); // Password passwordField.setBounds(107, 63, 149, 28); this.add(passwordField); // Button btnSubmit.setBounds(107, 114, 88, 29); this.add(btnSubmit); }
/** Create the frame. */ public VentanaSugerencias() { getContentPane().setBackground(Color.DARK_GRAY); setBounds(100, 100, 587, 576); getContentPane().setLayout(null); txtCAS = new JTextArea(); textPane = new JScrollPane(); textPane.setBounds(55, 150, 464, 353); textPane.setViewportView(txtCAS); getContentPane().add(textPane); lblLabelenviar = new JLabel(""); lblLabelenviar.setBounds(416, 29, 103, 91); iconoEnviar = new ImageIcon( new ImageIcon(VentanaSugerencias.class.getResource("/Imagenes/enviar.png")) .getImage() .getScaledInstance( lblLabelenviar.getWidth(), lblLabelenviar.getHeight(), Image.SCALE_DEFAULT)); lblLabelenviar.setIcon(iconoEnviar); getContentPane().add(lblLabelenviar); JLabel lblQuejasYSugerencias = new JLabel("Quejas y sugerencias"); lblQuejasYSugerencias.setFont(new Font("Tahoma", Font.PLAIN, 25)); lblQuejasYSugerencias.setForeground(Color.WHITE); lblQuejasYSugerencias.setBounds(71, 61, 264, 46); getContentPane().add(lblQuejasYSugerencias); }
public int doLayoutRetHeight() { Dimension sz = getSize(); final int itemHeight = 25; final int itemSpacing = 5; final int labelWidth = 150; final int buttonHeight = 35; final int buttonWidth = 100; int y = itemSpacing; int fieldWidth = sz.width - (itemSpacing + labelWidth + itemSpacing + itemSpacing); int fieldX = itemSpacing + labelWidth + itemSpacing; int buttonSpacing = (sz.width - (buttonWidth + buttonWidth)) / 4; labelFileName.setBounds(itemSpacing, y, labelWidth, itemHeight); textFileName.setBounds(fieldX, y, fieldWidth, itemHeight); y = y + itemHeight + itemSpacing; labelLogContents.setBounds(itemSpacing, y, labelWidth, itemHeight); int logContentsHeight = sz.height - (y + buttonHeight + itemSpacing + itemSpacing); if (logContentsHeight < 100) { logContentsHeight = 100; } textLogContents.setBounds(fieldX, y, fieldWidth, logContentsHeight); y = y + logContentsHeight + itemSpacing + itemSpacing; buttonChooseFile.setBounds(buttonSpacing, y, buttonWidth, buttonHeight); buttonImportFile.setBounds( buttonSpacing + buttonWidth + buttonSpacing, y, buttonWidth, buttonHeight); buttonClose.setBounds( buttonSpacing + buttonWidth + buttonSpacing + buttonWidth + buttonSpacing, y, buttonWidth, buttonHeight); y = y + buttonHeight + itemSpacing + itemSpacing; return (y); }
/** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { jLabel41 = new JLabel(); jLabel41.setBounds(new Rectangle(500, 176, 82, 16)); jLabel41.setText("Activar tiempo"); jLabel4 = new JLabel(); jLabel4.setBounds(new Rectangle(500, 130, 177, 16)); jLabel4.setText("a=opcion, b=pasadas, p =primo"); jLabel3 = new JLabel(); jLabel3.setBounds(new Rectangle(500, 88, 91, 16)); jLabel3.setText("log [a] b (mod p)"); jLabel2 = new JLabel(); jLabel2.setBounds(new Rectangle(500, 44, 67, 16)); jLabel2.setText("a^b (mod p)"); jLabel = new JLabel(); jLabel.setBounds(new Rectangle(53, 14, 128, 16)); jLabel.setText("Selecciona una opci�n"); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.add(getLogaritmo(), null); jContentPane.add(getPrimos(), null); jContentPane.add(getPotencia(), null); jContentPane.add(jLabel, null); jContentPane.add(getA(), null); jContentPane.add(getB(), null); jContentPane.add(getP(), null); jContentPane.add(jLabel2, null); jContentPane.add(jLabel3, null); jContentPane.add(jLabel4, null); jContentPane.add(getTiempo(), null); jContentPane.add(getJRadioButton(), null); jContentPane.add(jLabel41, null); } return jContentPane; }
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); }
private void initPanel() { masterPanel.add(initPanel, SELECTSARTYPE); initPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); initPanel.setLayout(null); JPanel panel = new JPanel(); panel.setBorder( new TitledBorder( null, "Inititate New SAR Operation", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setBounds(10, 11, 523, 340); initPanel.add(panel); panel.setLayout(null); typeSelectionComboBox = new JComboBox<String>(); typeSelectionComboBox.setBounds(126, 21, 102, 20); panel.add(typeSelectionComboBox); typeSelectionComboBox.setModel( new DefaultComboBoxModel<String>( new String[] { "Simple SAR", "Rapid Response", "Datum Point", "Datum Line", "Back Track" })); typeSelectionComboBox.addActionListener(this); JLabel lblSelectSarType = new JLabel("Select SAR Type"); lblSelectSarType.setBounds(10, 24, 140, 14); panel.add(lblSelectSarType); descriptiveText = new JTextPane(); descriptiveText.setBounds(10, 52, 503, 112); panel.add(descriptiveText); // descriptiveText.setBackground(UIManager.getColor("Button.background")); descriptiveText.setOpaque(false); descriptiveText.setEditable(false); descriptiveText.setText(rapidresponseTxt); descriptiveImage = new JLabel(" "); descriptiveImage.setHorizontalAlignment(SwingConstants.CENTER); descriptiveImage.setBounds(20, 131, 493, 200); panel.add(descriptiveImage); descriptiveImage.setIcon(simpleSarIcon); lblOrImportSar = new JLabel("Or import SAR from external file:"); lblOrImportSar.setBounds(238, 24, 176, 14); panel.add(lblOrImportSar); btnImport = new JButton("Import"); btnImport.setBounds(408, 20, 89, 23); panel.add(btnImport); btnImport.addActionListener(this); }
/** Create the frame. */ public Login() { setTitle("LOGIN"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(450, 333); setLocationRelativeTo(null); contentPane = new JPanel(); contentPane.setBackground(new Color(204, 255, 255)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel = new JPanel(); panel.setBorder(new LineBorder(new Color(0, 0, 0))); panel.setBounds(44, 43, 344, 208); contentPane.add(panel); panel.setLayout(null); JLabel lblNewLabel = new JLabel("USER : "******"PASSWORD:"******""); label.setBounds(30, 40, 32, 32); panel.add(label); label.setIcon(new ImageIcon(Login.class.getResource("/recursos/Administrator-icon.png"))); JLabel label_1 = new JLabel(""); label_1.setBounds(30, 98, 32, 32); panel.add(label_1); label_1.setIcon(new ImageIcon(Login.class.getResource("/recursos/key .png"))); JButton btnNewButton = new JButton("LOGIN"); btnNewButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) {} }); btnNewButton.setBounds(30, 145, 273, 37); panel.add(btnNewButton); JComboBox comboBox = new JComboBox(); comboBox.setBounds(153, 39, 150, 32); panel.add(comboBox); JLabel lblNewLabel_2 = new JLabel(""); lblNewLabel_2.setIcon( new ImageIcon( Login.class.getResource( "/recursos/wallpaper_celeste_y_violeta__abstracto__by_tutorialespopcorn-d6accdr.png"))); lblNewLabel_2.setBounds(0, 0, 450, 300); contentPane.add(lblNewLabel_2); }
public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { if (x > 20) { x -= 5; // y+=5; } } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { x += 10; // if(y>0) // y--; } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { if (position == 2) { position = 1; car.setBounds(120, 500, 120, 70); } if (position == 3) { position = 2; car.setBounds(240, 500, 120, 70); } } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { if (position == 2) { position = 3; car.setBounds(360, 500, 120, 70); } if (position == 1) { position = 2; car.setBounds(240, 500, 120, 70); } } }
private void initPanel() { JLabel sizeLabel = new JLabel("capacity"); sizeLabel.setBounds(5, 5, 900, 25); add(sizeLabel); roomSize = new RestrictedTextField(RestrictedTextField.RESTRICTION_INT, -1); roomSize.setBounds(sizeLabel.getX(), sizeLabel.getY() + sizeLabel.getHeight() + 5, 150, 25); roomSize.addKeyListener( new KeyListener() { @Override public void keyTyped(KeyEvent arg0) { room.setcapacity(Integer.parseInt(roomSize.getText())); editVector.add(new Wrapper<Room>(room, Edit.edited)); } @Override public void keyPressed(KeyEvent e) {} @Override public void keyReleased(KeyEvent e) {} }); add(roomSize); JLabel hardwareLabel = new JLabel("Harware"); hardwareLabel.setBounds(roomSize.getX(), roomSize.getY() + 20, 900, 25); add(hardwareLabel); hardwarePanel = new HardwarePanel(hardwares, editVector); JScrollPane scroll = new JScrollPane(hardwarePanel); scroll.setBounds( hardwareLabel.getX(), hardwareLabel.getY() + hardwareLabel.getHeight() + 5, 320, 150); add(scroll); }
public void drawPoins() { int size; int dist = 20; JLabel welcome = new JLabel("Equipa 1 - " + Points.getRed() + " Pontos"); welcome.setFont(new Font("Arial", Font.BOLD, 18)); welcome.setForeground(Color.RED); size = 170; welcome.setBounds(((width - size) / 8) - dist, 100, size, 50); window.add(welcome); welcome = new JLabel("Equipa 2 - " + Points.getBlue() + " Pontos"); welcome.setFont(new Font("Arial", Font.BOLD, 18)); welcome.setForeground(Color.BLUE); welcome.setBounds((((width - size) * 7) / 8) + dist, 100, size, 50); window.add(welcome); welcome = new JLabel("Questao " + Questions7.pageid + " - " + Points.checkRed(Questions7.pageid)); welcome.setFont(new Font("Arial", Font.BOLD, 15)); welcome.setForeground(Color.RED); size = 170; welcome.setBounds(((width - size) / 8) - dist, 150, size, 50); window.add(welcome); welcome = new JLabel("Questao " + Questions7.pageid + " - " + Points.checkBlue(Questions7.pageid)); welcome.setFont(new Font("Arial", Font.BOLD, 15)); welcome.setForeground(Color.BLUE); welcome.setBounds((((width - size) * 7) / 8) + dist, 150, size, 50); window.add(welcome); }
private void componentes() { JLabel lblLogin = new JLabel("Login"); lblLogin.setFont(new Font("Tahoma", Font.PLAIN, 13)); lblLogin.setBounds(10, 11, 46, 14); getContentPane().add(lblLogin); jLogin = new JTextField(); jLogin.setBounds(66, 9, 128, 20); getContentPane().add(jLogin); jLogin.setColumns(10); JLabel lblSenha = new JLabel("Senha"); lblSenha.setFont(new Font("Tahoma", Font.PLAIN, 13)); lblSenha.setBounds(10, 36, 46, 14); getContentPane().add(lblSenha); jSenha = new JPasswordField(); jSenha.setBounds(66, 40, 128, 20); getContentPane().add(jSenha); jSenha.setColumns(10); btnEntrar = new JButton("Entrar"); btnEntrar.setBounds(204, 8, 128, 23); getContentPane().add(btnEntrar); btnNovoCadastro = new JButton("Novo Cadastro"); btnNovoCadastro.setBounds(204, 39, 128, 23); getContentPane().add(btnNovoCadastro); btnEsqueciASenha = new JButton("Esqueci a Senha"); btnEsqueciASenha.setBounds(66, 71, 128, 23); getContentPane().add(btnEsqueciASenha); }
private void setComponents() { label1 = new JLabel("AWS"); label1.setFont(new Font("Segoe UI Light", Font.PLAIN, 100)); label1.setBounds(100, 300, 300, 90); label1.setForeground(Color.WHITE); add(label1); label2 = new JLabel("Advanced Wildlife Systems"); label2.setFont(new Font("Segoe UI Light", Font.PLAIN, 20)); label2.setBounds(75, 300, 300, 200); label2.setForeground(Color.WHITE); add(label2); label3 = new JLabel("AWS Internal Use Only"); label3.setFont(new Font("Segoe UI Light", Font.PLAIN, 10)); label3.setBounds(200, 320, 300, 200); label3.setForeground(Color.WHITE); add(label3); add = new Button(new ImageIcon("images/add.png"), new ImageIcon("images/addH.png")); add.setLocation(340, 270); add(add); find = new Button(new ImageIcon("images/find.png"), new ImageIcon("images/findH.png")); find.setLocation(519, 270); add(find); exit = new Button(new ImageIcon("images/exit.png"), new ImageIcon("images/exitH.png")); exit.setLocation(698, 270); add(exit); }
/** Creates the field of checkboxes on each panel */ public FieldPanel() { // Loop trough the entire matrix, adding new checkboxes and adding data to them. // ShipCheckBox is a regular JCheckBox with x and y coordinates added to them. for (int y = 0; y < 10; y++) { for (int x = 0; x < 10; x++) { checkboxes[x][y] = new ShipCheckBox(); // Set the boxes 31px apart, 100px from the left and 50px from the top checkboxes[x][y].setBounds(x * 31 + 100, y * 31 + 50, 21, 21); checkboxes[x][y].setEnabled(false); checkboxes[x][y].setXCoord(x); checkboxes[x][y].setYCoord(y); checkboxes[x][y].setFocusable(false); checkboxes[x][y].setOpaque(false); this.add(checkboxes[x][y]); } // Add label on y-axis JLabel lblY = new JLabel(y + 1 + ""); lblY.setBounds(80, y * 31 + 45, 30, 30); this.add(lblY); // Add character labels on the x-axis. Increment the characters String value = "A"; int charValue = value.charAt(0); String next = String.valueOf((char) (charValue + y)); JLabel lblX = new JLabel(next); lblX.setBounds(y * 31 + 110, 25, 30, 30); this.add(lblX); } }
/** Create the panel. */ public Historic(ServerObjInterface objServidor, ResourceBundle rb) { this.rb = rb; this.objServidor = objServidor; setBounds(100, 100, 450, 300); setBorder( new TitledBorder( null, this.rb.getString("historic.titol"), TitledBorder.LEFT, TitledBorder.TOP, null, null)); setLayout(null); JLabel lblIncidncia = new JLabel(this.rb.getString("historic.incidencia")); lblIncidncia.setFont(new Font("Tahoma", Font.PLAIN, 15)); lblIncidncia.setBounds(131, 57, 69, 14); add(lblIncidncia); JLabel lblIncidencia = new JLabel(this.rb.getString("historic.tipusIncidencia")); lblIncidencia.setFont(new Font("Tahoma", Font.PLAIN, 15)); lblIncidencia.setBounds(83, 32, 135, 20); add(lblIncidencia); this.cmbTipusIncidencia = new JComboBox(); this.cmbTipusIncidencia.setBounds(228, 29, 212, 20); add(this.cmbTipusIncidencia); this.cmbIncidencia = new JComboBox(); this.cmbIncidencia.setBounds(228, 54, 212, 20); add(this.cmbIncidencia); JScrollPane scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBounds(10, 117, 430, 172); add(scrollPane); this.lstNotes = new JList(); this.lstNotes.setModel( new AbstractListModel() { /** */ private static final long serialVersionUID = -3023617430137119564L; String[] values = new String[] {}; public int getSize() { return values.length; } public Object getElementAt(int index) { return values[index]; } }); scrollPane.setViewportView(this.lstNotes); this.loadTipusIncidencies(); this.loadIncidencies(this.cmbTipusIncidencia.getItemAt(0).toString()); this.loadNotesIncidencia(this.hashRequests.get(this.cmbIncidencia.getItemAt(0).toString())); }
private void buildFields() { JLabel lbFaculty = new JLabel("Факультет:"); lbFaculty.setHorizontalAlignment(SwingConstants.RIGHT); lbFaculty.setBounds(new Rectangle(PAD, 0 * H_B + PAD, W_L, H_B)); add(lbFaculty); txtFaculty.setBounds(new Rectangle(W_L + 2 * PAD, 0 * H_B + PAD, W_T, H_B)); txtFaculty.setBorder(BorderFactory.createEtchedBorder()); add(txtFaculty); JLabel lbNOG = new JLabel("Группа:"); lbNOG.setHorizontalAlignment(SwingConstants.RIGHT); lbNOG.setBounds(new Rectangle(PAD, 1 * H_B + PAD, W_L, H_B)); add(lbNOG); txtNOG.setBounds(new Rectangle(W_L + 2 * PAD, 1 * H_B + PAD, W_T, H_B)); txtNOG.setBorder(BorderFactory.createEtchedBorder()); add(txtNOG); JLabel lbName = new JLabel("Имя:"); lbName.setHorizontalAlignment(SwingConstants.RIGHT); lbName.setBounds(new Rectangle(PAD, 2 * H_B + PAD, W_L, H_B)); add(lbName); txtName.setBounds(new Rectangle(W_L + 2 * PAD, 2 * H_B + PAD, W_T, H_B)); txtName.setBorder(BorderFactory.createEtchedBorder()); add(txtName); JLabel lbDOE = new JLabel("Дата зачисления:"); lbDOE.setHorizontalAlignment(SwingConstants.RIGHT); lbDOE.setBounds(new Rectangle(PAD, 3 * H_B + PAD, W_L, H_B)); add(lbDOE); txtDOE.setBounds(new Rectangle(W_L + 2 * PAD, 3 * H_B + PAD, W_T, H_B)); txtDOE.setBorder(BorderFactory.createEtchedBorder()); add(txtDOE); }
/** * This method initializes mContentPanePanel * * @return javax.swing.JPanel */ private JPanel getMContentPanePanel() { if (mContentPanePanel == null) { JLabel mIndividualsLabel = new JLabel(); mIndividualsLabel.setBounds(new java.awt.Rectangle(228, 82, 71, 16)); mIndividualsLabel.setText("Instances"); JLabel mOWLClassesLabel = new JLabel(); mOWLClassesLabel.setBounds(new java.awt.Rectangle(9, 84, 157, 16)); mOWLClassesLabel.setText("Guideline Class"); JLabel mURILabel = new JLabel(); mURILabel.setBounds(new java.awt.Rectangle(10, 23, 58, 16)); mURILabel.setText("URI"); mContentPanePanel = new JPanel(); mContentPanePanel.setLayout(null); mContentPanePanel.add(getMIndividualListComboBox(), null); mContentPanePanel.add(getMClassField(), null); mContentPanePanel.add(getMURITextField(), null); // mContentPanePanel.add(getMNewInstanceButton(), null); mContentPanePanel.add(getMConvertSelectedInstance2ObjectButton(), null); mContentPanePanel.add(getMLoadURIButton(), null); mContentPanePanel.add(mURILabel, null); mContentPanePanel.add(mOWLClassesLabel, null); mContentPanePanel.add(mIndividualsLabel, null); } return mContentPanePanel; }