public void actionPerformed(ActionEvent e) { if (e.getSource() == ctl) { this.menu(); } else if (e.getSource() == exit) { exitPerform(); } else if (e.getSource() == rank) { if (count != 0) { card.show(mainPanel, "four"); rankPanel.setMemory(memory, count - 1); buttonPanel.removeAll(); buttonPanel.setBounds(width - 200, height - 80, 190, 50); buttonPanel.add(exit); check = 4; count--; } } else if (e.getSource() == back) { if (secondPanel.clip != null) { secondPanel.clip.stop(); System.out.printf("test"); } check = 0; card.previous(mainPanel); buttonPanel.removeAll(); ctl.setText("- Play -"); buttonPanel.add(ctl); buttonPanel.add(rank); buttonPanel.add(exit); buttonPanel.setOpaque(false); buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100); } }
/** * Updates the position and size of the edit panel relative to the given location. * * @param loc the location the edit panel should be relative to * @param absolute if {@code true} the loc is treated as absolute position on the process * renderer; if {@code false} it is treated as relative to the current process */ private void updateEditPanelPosition(final Rectangle2D loc, final boolean absolute) { int panelX = (int) loc.getCenterX() - EDIT_PANEL_WIDTH / 2; int panelY = (int) loc.getY() - EDIT_PANEL_HEIGHT - ProcessDrawer.PADDING; // if panel would be outside process renderer, fix it if (panelX < WorkflowAnnotation.MIN_X) { panelX = WorkflowAnnotation.MIN_X; } if (panelY < 0) { panelY = (int) loc.getMaxY() + ProcessDrawer.PADDING; } // last fallback is cramped to the bottom. If that does not fit either, don't care if (panelY + EDIT_PANEL_HEIGHT > view.getSize().getHeight() - ProcessDrawer.PADDING * 2) { panelY = (int) loc.getMaxY(); } int index = view.getModel().getProcessIndex(model.getSelected().getProcess()); if (absolute) { editPanel.setBounds(panelX, panelY, EDIT_PANEL_WIDTH, EDIT_PANEL_HEIGHT); } else { Point absoluteP = ProcessDrawUtils.convertToAbsoluteProcessPoint( new Point(panelX, panelY), index, rendererModel); editPanel.setBounds( (int) absoluteP.getX(), (int) absoluteP.getY(), EDIT_PANEL_WIDTH, EDIT_PANEL_HEIGHT); } }
@Override public void doLayout() { int width = getWidth(); int height = getHeight(); canvas.setBounds(0, 0, width, height); overlay.setBounds(0, 0, width, height); }
public void generateMagnifiedTileBar(ArrayList<Integer> selectedChapters) { hasBeenMagnified = true; this.removeAll(); tileBar.removeAll(); int accumulator = 0; for (int i = 0; i < selectedChapters.size(); i++) { chapterTiles.get(selectedChapters.get(i)).magnifyTileBar(magnification); chapterTiles .get(selectedChapters.get(i)) .setBounds( moveX + (offSetBetweenTiles * i + accumulator) * magnification, moveY, ((selected.getChapter(selectedChapters.get(i)).getEnd() - selected.getChapter(selectedChapters.get(i)).getStart()) + 1) * magnification, 52); ArrayList<Chapter> subChapters = chapterTiles.get(selectedChapters.get(i)).getChapter().getSubChapters(); for (Chapter c : subChapters) { // Add the two ticks(top/bottom) JPanel topMarker = new JPanel(); topMarker.setBackground(Color.GRAY); topMarker.setBounds( new Rectangle( (moveX + (c.getStart() - chapterTiles.get(selectedChapters.get(i)).getChapter().getStart() + offSetBetweenTiles * i + accumulator) * magnification), moveY - markerLength, 1, markerLength)); this.add(topMarker); JPanel bottomMarker = new JPanel(); bottomMarker.setBackground(Color.GRAY); bottomMarker.setBounds( (moveX + (c.getStart() - chapterTiles.get(selectedChapters.get(i)).getChapter().getStart() + offSetBetweenTiles * i + accumulator) * magnification), 52 + moveY, 1, markerLength); this.add(bottomMarker); } accumulator += selected.getChapter(selectedChapters.get(i)).getEnd() - selected.getChapter(selectedChapters.get(i)).getStart() + 1; tileBar.add(chapterTiles.get(selectedChapters.get(i))); this.add(chapterTiles.get(selectedChapters.get(i))); } }
/** Create the panel. */ public HuntingPanel(Frame frame) { this.frame = frame; setSize(new Dimension(800, 600)); setLayout(null); JPanel panel = new JPanel(); panel.setBackground(new Color(204, 153, 51)); panel.setBounds(0, 443, 800, 157); add(panel); panel.setLayout(null); CustomButton cstmbtnReturn = new CustomButton((String) null); cstmbtnReturn.setFont(new Font("Tahoma", Font.BOLD, 22)); cstmbtnReturn.addActionListener(new ButtonListener()); cstmbtnReturn.setText("Return"); cstmbtnReturn.setBounds(628, 36, 162, 82); panel.add(cstmbtnReturn); JPanel panel_1 = new JPanel(); panel_1.setBounds(10, 11, 187, 135); panel.add(panel_1); panel_1.setLayout(null); txtPoundsOfFood = new JLabel(); txtPoundsOfFood.setFont(new Font("Tahoma", Font.BOLD, 15)); txtPoundsOfFood.setText("Pounds of Food Shot"); txtPoundsOfFood.setBounds(15, 11, 160, 25); panel_1.add(txtPoundsOfFood); poundsShot = new JLabel(); poundsShot.setHorizontalAlignment(SwingConstants.CENTER); poundsShot.setFont(new Font("Tahoma", Font.PLAIN, 48)); poundsShot.setBounds(15, 47, 160, 77); panel_1.add(poundsShot); JPanel panel_2 = new JPanel(); panel_2.setBounds(307, 11, 187, 135); panel.add(panel_2); panel_2.setLayout(null); txtBulletsRemaining = new JLabel(); txtBulletsRemaining.setFont(new Font("Tahoma", Font.BOLD, 16)); txtBulletsRemaining.setText("Bullets Remaining"); txtBulletsRemaining.setBounds(15, 11, 156, 26); panel_2.add(txtBulletsRemaining); bulletsRemaining = new JLabel(); bulletsRemaining.setHorizontalAlignment(SwingConstants.CENTER); bulletsRemaining.setFont(new Font("Tahoma", Font.PLAIN, 48)); bulletsRemaining.setBounds(15, 47, 156, 77); panel_2.add(bulletsRemaining); huntPanel = new HuntPanel(frame, this); huntPanel.setBounds(0, 0, 800, 445); add(huntPanel); }
/** Create the frame. */ public BrowseModule() { setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 800, 600); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JPanel panel = new JPanel(); panel.setBorder( new TitledBorder( null, "Vehicle Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setBounds(16, 10, 376, 291); contentPane.add(panel); panel.setLayout(null); list = new JList<String>(listStr); list.setBounds(6, 16, 364, 268); panel.add(list); list.setFont(new Font("Arial", Font.PLAIN, 16)); list.addListSelectionListener(this); JPanel panel_1 = new JPanel(); panel_1.setBorder( new TitledBorder( null, "Vehicle Example", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_1.setBounds(399, 10, 381, 291); contentPane.add(panel_1); panel_1.setLayout(null); lblNewLabel = new JLabel(); lblNewLabel.setBounds(6, 16, 369, 268); panel_1.add(lblNewLabel); lblNewLabel.setIcon(pics[0]); panel_2 = new JPanel(); panel_2.setBorder( new TitledBorder( null, "Additional Equipment/Services", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_2.setBounds(122, 316, 512, 198); contentPane.add(panel_2); panel_2.setLayout(null); label = new JLabel(); label.setBounds(6, 16, 500, 175); panel_2.add(label); label.setText( "<HTML>GPS Receiver - $15/day<BR>Child Seat - $10/day<BR>K-TAG Rental - $2/day (plus accumulated tolls)" + "<BR>Roadside Assistance - $7/day<BR>Loss Damage Waiver Insurance - $25/day<BR>Personal Accident Insurance - $5/day</HTML>"); }
@Override public void doLayout() { if (labelBar == null || listPanel == null) return; Dimension d = listPanel.getPreferredSize(); Component p = getParent(); int w = p == null ? d.width : getParent().getWidth(); int y = 0; labelBar.setBounds(0, y, w, 30); y += 30; //noinspection SuspiciousNameCombination listPanel.setBounds(y, 33, w, d.height); }
public GUI() { setTitle(APP_NAME); setLookAndFeel(); // Create a new Frame setSize(840, 600); // The window Dimensions setMinimumSize(new Dimension(600, 450)); setLocationRelativeTo(null); // center window setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // create panel with border layout JPanel panel = new JPanel(new BorderLayout()); panel.setBounds(0, 0, 600, 600); fretboardPanel = new FretboardPanel(); panel.add(fretboardPanel, BorderLayout.CENTER); staffPanel = new StaffPanel(); staffPanel.setPreferredSize(new Dimension(200, 200)); panel.add(staffPanel, BorderLayout.SOUTH); toolbarPanel = new ToolbarPanel(); panel.add(toolbarPanel, BorderLayout.NORTH); // add Panel to Window Frame add(panel); // add Menu // at the moment the menu is not used // setJMenuBar(new MainMenu()); setVisible(true); }
@Override public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); int w = getWidth() - (SHADOW_SIZE - 2) * 2; int h = getHeight() - (SHADOW_SIZE - 2) * 2; int arc = 15; int shadowSize = SHADOW_SIZE; shadow = GraphicsUtilities.createCompatibleTranslucentImage(w, h); Graphics2D g2 = shadow.createGraphics(); if (active) { g2.setColor(new Color(243, 238, 39, 150)); } else { g2.setColor(Color.WHITE); } g2.setColor(Color.WHITE); g2.fillOval(0, 0, w, h); g2.dispose(); ShadowRenderer renderer = new ShadowRenderer(shadowSize, 0.5f, Color.BLACK); shadow = renderer.createShadow(shadow); g2 = shadow.createGraphics(); g2.setColor(Color.GRAY); g2.setComposite(AlphaComposite.Clear); g2.fillOval(shadowSize, shadowSize, w, h); g2.dispose(); }
private void setButton() { JPanel buttonSpace = new JPanel(); JButton back = new JButton("<"); JButton next = new JButton(">"); JButton first = new JButton("<<"); JButton last = new JButton(">>"); buttonSpace.setOpaque(true); buttonSpace.setBackground(Color.GRAY); buttonSpace.setLayout(new BoxLayout(buttonSpace, BoxLayout.X_AXIS)); buttonSpace.setPreferredSize(new Dimension(this.getPreferredSize().width, 20)); bsWidth = this.getPreferredSize().width; bsLength = 20; buttonSpace.setBounds(0, 0, bsWidth, bsLength); buttonSpace.setVisible(true); this.add(buttonSpace, JLayeredPane.DEFAULT_LAYER); buttonSpace.setOpaque(true); buttonSpace.add(first); buttonSpace.add(back); buttonSpace.add(next); buttonSpace.add(last); first.setVisible(true); back.setVisible(true); next.setVisible(true); last.setVisible(true); first.addActionListener(this); back.addActionListener(this); next.addActionListener(this); last.addActionListener(this); }
/** Create the frame. */ public ViewGainFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); setTitle("获取数据库中所有存储过程"); JPanel panel = new JPanel(); panel.setBounds(0, 0, 434, 262); contentPane.add(panel); panel.setLayout(null); JLabel massageLabel = new JLabel("获取db_database24数据库下的所有存储过程名:"); massageLabel.setFont(new Font("华文琥珀", Font.PLAIN, 13)); massageLabel.setBounds(65, 20, 297, 27); panel.add(massageLabel); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(54, 71, 316, 159); panel.add(scrollPane); JTextArea textArea = new JTextArea(); scrollPane.setViewportView(textArea); GainProcedure procedure = new GainProcedure(); // 创建工具类对象 List list = procedure.executeGain(); // 调用获取所有存储过程方法 for (int i = 0; i < list.size(); i++) { // 循环遍历查询结果 String name = list.get(i).toString(); // 获取结果集中数据 textArea.append(name + "\n"); // 向文本域中添加信息 } }
/** * Cria uma instância do painel confirmação utilizado pelas janelas <code>IgCadCliente</code>, * <code>IgAbrirContaBancaria</code> e <code>IgCriarAplicacao</code> * * @param tituloDaBorda <code>String</code> referênte ao título da borda do campo de texto dados */ public PainelConfCad(String tituloDaBorda) { setLayout(null); JPanel panelDadosCliente = new JPanel(); panelDadosCliente.setLayout(null); panelDadosCliente.setBorder( new TitledBorder( null, tituloDaBorda, TitledBorder.LEADING, TitledBorder.TOP, null, SystemColor.textHighlight)); panelDadosCliente.setBounds(10, 11, 497, 274); add(panelDadosCliente); JScrollPane dadosScrollPane = new JScrollPane(); dadosScrollPane.setBorder(null); dadosScrollPane.setBounds(10, 20, 477, 243); panelDadosCliente.add(dadosScrollPane); dadosEditorPane = new JEditorPane(); dadosEditorPane.setForeground(Color.BLACK); dadosEditorPane.setBackground(new Color(238, 238, 238)); dadosScrollPane.setViewportView(dadosEditorPane); dadosEditorPane.setFont(new Font("Arial", Font.BOLD, 14)); dadosEditorPane.setToolTipText("este campo exibe os dados inseridos nas janelas anteriores"); dadosEditorPane.setEditable(false); }
/* * 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); }
/** * Costruttore * * @param buttonCommonalitiesEnd */ public ViewPanelCentral(JButton buttonCommonalitiesEnd) { this.buttonCommonalitiesEnd = buttonCommonalitiesEnd; panelAnalysis = new JPanel(); panelAnalysis.setLayout(null); panelAnalysis.setBounds(320, 100, 1100, 612); }
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); }
public void changePanel() { card.next(mainPanel); buttonPanel.removeAll(); ctl.setText("- Play -"); buttonPanel.add(ctl); buttonPanel.add(rank); buttonPanel.add(exit); buttonPanel.setOpaque(false); buttonPanel.setBounds(width / 2 - 50, height / 2 - 50, 80, 100); count++; memory[count] = new Memory(); menuPanel.setMemory(memory[count]); secondPanel.setMemory(memory[count]); gamePanel.setMemory(memory[count]); rankPanel.setMemory(memory, count); check = 0; System.out.println( count + " " + memory[count - 1].name + " " + memory[count - 1].song + " " + memory[count - 1].score); }
private static void InfoPanel() { boxpanel.setLayout(null); // Info Box for the Slider final JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 200, 100); slider.setMajorTickSpacing(10); slider.setMinorTickSpacing(1); slider.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { Speed = slider.getValue(); // if the Speed is lower then 100 then it's behind the slider(fix for it) if (Speed < 100) { if (Speed < 10) { SpeedText.setText("00" + Integer.toString(Speed)); } else SpeedText.setText("0" + Integer.toString(Speed)); } else SpeedText.setText(Integer.toString(Speed)); } }); boxpanel.setBounds(400, 0, 240, 350); // boxpanel.setBackground(Color.WHITE); slider.setBounds(10, 20, 220, 30); SpeedText.setBounds(110, 40, 30, 30); boxpanel.add(slider); boxpanel.add(SpeedText); boxpanel.setBorder(BorderFactory.createTitledBorder("Simulatie")); contentPane.add(boxpanel); }
public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); for (int i = 0; i < components.size(); i++) { components.get(i).setSize(width, height); // components.get(i).setBounds(x, y, width, height); } }
public void returnToPanel() { getContentPane().removeAll(); getContentPane().add(previousJPanel); getContentPane().repaint(); getContentPane().revalidate(); previousJPanel.setBounds(0, 0, 578, 350); // Don't Forget This }
public void changePanel(JPanel jpanel) { getContentPane().removeAll(); getContentPane().add(jpanel); getContentPane().repaint(); getContentPane().revalidate(); jpanel.setBounds(0, 0, 578, 350); // Don't Forget This }
public Fenetre(JFrame f) { frame_precedente = f; this.setTitle("Shitenno"); this.setSize(1200, 750); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); this.setContentPane(new Panneau()); this.setLayout(null); // personnalisation du panel recouvrant toute la frame panelplateau.setOpaque(false); panelplateau.setBounds(0, 0, 1200, 800); this.add(panelplateau); // ajout des boutons passer sont tour et menu quitter.addActionListener(this); this.add(quitter); quitter.setBounds(1080, 620, 80, 30); passer_tour.addActionListener(this); this.add(passer_tour); passer_tour.setBounds(1080, 670, 80, 30); // this.setContentPane(new Panneau()); // this.setContentPane(new Mainjoueur()); // affichage de la frame this.setVisible(true); }
/** 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 Pruebas() { setTitle("Pruebas"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(null); CbClientes cbClientes = new CbClientes(); cbClientes.setBounds(34, 11, 165, 29); getContentPane().add(cbClientes); CbAviones cbAviones = new CbAviones(); cbAviones.setBounds(34, 51, 165, 29); getContentPane().add(cbAviones); CbDestinos cbDestinos = new CbDestinos(); cbDestinos.setBounds(33, 94, 166, 29); getContentPane().add(cbDestinos); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(34, 146, 270, 147); getContentPane().add(scrollPane); table = new TbVuelosCompletos(""); scrollPane.setViewportView(table); JPanel panel = new JPanel(); panel.setBounds(330, 11, 270, 282); panel.setLayout(null); getContentPane().add(panel); PnAsientosAvion pnAsientosAvion = new PnAsientosAvion(new Avion(0, "AirBus", 16), null); panel.add(pnAsientosAvion); setVisible(true); }
private void addHeaderComponents() { this.title = new JLabel("Gregg Shorthand Recognizer"); this.title.setBounds(250, 50, 300, 30); this.title.setFont(new Font("Sans Serif", Font.BOLD, 20)); this.add(title); this.heading = new JLabel("Train and Test"); this.heading.setBounds(120, 105, 200, 30); this.heading.setFont(new Font("Sans Serif", Font.BOLD, 16)); this.heading.setForeground(Color.WHITE); this.add(heading); backButton = new JButton(); backButton.setBounds(50, 97, 45, 45); this.add(backButton); backButton.setFocusPainted(false); backButton.setBorderPainted(false); backButton.setContentAreaFilled(false); backButton.setOpaque(false); backButton.addActionListener(this); Image img; try { img = ImageIO.read(new File("images/ui/button.png")); backButton.setIcon(new ImageIcon(img)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } navBar = new JPanel(); navBar.setBounds(0, 100, 800, 40); navBar.setBackground(new Color(0, 174, 239)); this.add(navBar); }
/** Create the frame. */ public TowerdefenceGui(IGameController controller) { guiState = new GuiState(); propertiesGui = new PropertiesGui(controller, guiState); playingFieldGui = new PlayingFieldGui(controller, guiState, propertiesGui, WIDTH, HEIGHT); controlGui = new ControlGui(controller, guiState); playerGui = new PlayerGui(controller); // Default Settings GUI setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 688, 447); contentPane = new JPanel(); contentPane.setBackground(new Color(70, 130, 180)); contentPane.setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER)); setContentPane(contentPane); contentPane.setLayout(null); // PlayingField playingFieldPanel = playingFieldGui; playingFieldPanel.setBackground(new Color(255, 255, 255)); playingFieldPanel.setBounds(BOUNDS, BOUNDS, WIDTH, HEIGHT); contentPane.add(playingFieldPanel); playingFieldPanel.setLayout(null); // Properties propertiesPanel = propertiesGui; propertiesPanel.setBackground(new Color(224, 255, 255)); propertiesPanel.setBounds(457, 0, 209, 310); contentPane.add(propertiesPanel); propertiesPanel.setLayout(null); // Controll controlPanel = controlGui; controlPanel.setBackground(new Color(224, 255, 255)); controlPanel.setBounds(0, 319, 451, 82); contentPane.add(controlPanel); controlPanel.setLayout(null); // Player playerPanel = playerGui; playerPanel.setBackground(new Color(224, 255, 255)); playerPanel.setBounds(457, 319, 209, 82); contentPane.add(playerPanel); playerPanel.setLayout(null); setVisible(true); }
public _ABM_Interfaz_Chofer() { setIconifiable(true); setClosable(true); getContentPane().setBackground(Color.WHITE); JPanel panel = new JPanel(); panel.setBounds(6, 6, 584, 210); panel.setBorder(new LineBorder(new Color(0, 0, 0))); panel.setBackground(Color.WHITE); JPanel panel_1 = new JPanel(); panel_1.setBounds(6, 228, 584, 210); panel_1.setBorder(new LineBorder(new Color(0, 0, 0))); panel_1.setBackground(Color.WHITE); getContentPane().setLayout(null); getContentPane().add(panel); panel.setLayout(null); textField = new JTextField(); textField.setBounds(86, 50, 122, 28); panel.add(textField); textField.setColumns(10); textField_1 = new JTextField(); textField_1.setColumns(10); textField_1.setBounds(86, 90, 122, 28); panel.add(textField_1); textField_2 = new JTextField(); textField_2.setColumns(10); textField_2.setBounds(86, 130, 122, 28); panel.add(textField_2); textField_3 = new JTextField(); textField_3.setColumns(10); textField_3.setBounds(86, 170, 122, 28); panel.add(textField_3); textField_4 = new JTextField(); textField_4.setColumns(10); textField_4.setBounds(86, 16, 122, 28); panel.add(textField_4); getContentPane().add(panel_1); panel_1.setLayout(null); setBounds(100, 100, 608, 475); }
public void paint(Graphics g) { // super.repaint(); pWidth = this.getWidth() - (inset.left + inset.right); pHeight = this.getHeight() - (inset.top + inset.bottom); top.setBounds(0, 0, pWidth, (int) (pHeight * (1.0f - graphVerticalSize))); nodeGraph.setBounds(0, 0, (int) (top.getWidth() * 0.8f) - 5, top.getHeight()); nodeGraphView.setBounds(0, 20, nodeGraph.getWidth(), nodeGraph.getHeight() - 20); nodeGraphView.getGraphLayout().setSize(nodeGraphView.getSize()); nodeGraphInform.setBounds( (int) (top.getWidth() * 0.8f), 20, (int) (top.getWidth() * 0.2f), top.getHeight() - 20); nodeGraphMap.setBounds(0, 0, nodeGraphInform.getWidth(), nodeGraphInform.getWidth()); nodeGraphMap .getGraphLayout() .setSize(new Dimension(nodeGraphInform.getWidth(), nodeGraphInform.getWidth())); nodeGraphProtocolView.setBounds( 0, nodeGraphMap.getHeight() + 5, nodeGraphInform.getWidth(), nodeGraphInform.getHeight() - nodeGraphMap.getHeight() - 5); /* Relaxer relaxer = nodeGraphView.getModel().getRelaxer(); if(relaxer != null) { relaxer.stop(); relaxer.prerelax(); relaxer.relax(); } */ trafficGraph.setBounds( 0, (int) (pHeight * (1.0f - graphVerticalSize)) + 10, pWidth, (int) (pHeight * graphVerticalSize)); trafficGraph.repaint(); graphVerticalSizeBt.setBounds(0, (int) (pHeight * (1.0f - graphVerticalSize)), pWidth, 10); graphVerticalSizeBt.repaint(); graphHorizontalSizeBt.setBounds((int) (top.getWidth() * 0.8f) - 5, 20, 5, top.getHeight()); graphHorizontalSizeBt.repaint(); }
// initialize panneau du millieu public void initPanneauMillieu() { final int X = PADDING_X + 10; final int LARG_PANNEAU_MILLEU = LARG_FENETRE - (2 * X); final int HAUT_PANNEAU_MILLEU = 300; milieu.setLayout(null); milieu.setBounds(X, haut.getY() + haut.getHeight(), LARG_PANNEAU_MILLEU, HAUT_PANNEAU_MILLEU); milieu.setBorder(new LineBorder(GRIS_FONCE, 2)); }
@Override public void setBounds(final java.awt.Rectangle BOUNDS) { super.setBounds(BOUNDS); calcInnerBounds(); init(BOUNDS.width, BOUNDS.height); revalidate(); repaint(); }
@Override public void setBounds(final int X, final int Y, final int WIDTH, final int HEIGHT) { super.setBounds(X, Y, WIDTH, HEIGHT); calcInnerBounds(); init(WIDTH, HEIGHT); revalidate(); repaint(); }