private void init(icwarehousemanui icwarehousemanui) { icwarehousemanJpanel = new icwarehousemanJpanel(); operationJpanel = new icwarehousemanb2OperationJpanel(icwarehousemanJpanel, icwarehousemanui, this); ImageIcon b1Icon = new ImageIcon("picture/新建入库单.png"); ImageIcon b2Icon = new ImageIcon("picture/单据反馈.png"); b1 = new JButton(b1Icon); b2 = new JButton(b2Icon); b1.setBounds(30, 200, 200, 50); b2.setBounds(30, 400, 200, 50); b1.setContentAreaFilled(false); b2.setContentAreaFilled(false); icwarehousemanJpanel.add(b1); icwarehousemanJpanel.add(b2); icwarehousemanJpanel.add(operationJpanel); icwarehousemanJpanel.setLayout(null); this.add(icwarehousemanJpanel); this.setSize(1024, 730); // 居中 Toolkit kitToolkit = Toolkit.getDefaultToolkit(); Dimension screenSize = kitToolkit.getScreenSize(); int screenWidth = screenSize.width; int screenHeight = screenSize.height; int windowWidth = this.getWidth(); int windowHeight = this.getHeight(); this.setLocation((screenWidth - windowWidth) / 2, (screenHeight - windowHeight) / 2); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 不允许窗口改变大小 this.setResizable(false); this.setVisible(true); }
/** Install Add and Remove Buttons into the toolbar */ private void installAddRemovePointButtons() { URL imgURL = ClassLoader.getSystemResource("ch/tbe/pics/plus.gif"); ImageIcon plus = new ImageIcon(imgURL); imgURL = ClassLoader.getSystemResource("ch/tbe/pics/minus.gif"); ImageIcon minus = new ImageIcon(imgURL); add = new JButton(plus); rem = new JButton(minus); add.setToolTipText(workingViewLabels.getString("plus")); rem.setToolTipText(workingViewLabels.getString("minus")); add.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { WorkingView.this.addRemovePoint(true); } }); rem.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { WorkingView.this.addRemovePoint(false); } }); add.setContentAreaFilled(false); add.setBorderPainted(false); rem.setContentAreaFilled(false); rem.setBorderPainted(false); toolbar.add(add); toolbar.add(rem); }
private void createButtons() { int iconSize = 16; // app.getScaledIconSize(); int toggleSize = (int) Math.round(app.getScaledIconSize() * 0.75); // button to show/hide styling bar and the title panel buttons toggleStyleBarButton = new JButton(); toggleStyleBarButton.addActionListener(this); toggleStyleBarButton.setFocusPainted(false); toggleStyleBarButton.setBorderPainted(false); toggleStyleBarButton.setContentAreaFilled(false); toggleStyleBarButton.setPreferredSize(new Dimension(toggleSize, toggleSize)); toggleStyleBarButton.setRolloverEnabled(true); // button to show/hide styling bar if the title panel is invisible toggleStyleBarButton2 = new JButton(); toggleStyleBarButton2.setFocusPainted(false); toggleStyleBarButton2.setBorderPainted(false); toggleStyleBarButton2.setContentAreaFilled(false); toggleStyleBarButton2.setPreferredSize(new Dimension(toggleSize, toggleSize)); toggleStyleBarButton2.addActionListener(this); toggleStyleBarButton2.setRolloverEnabled(true); updateToggleStyleBarButtons(); // button to insert the view in the main window unwindowButton = new JButton(app.getScaledIcon("view-unwindow.png")); unwindowButton.addActionListener(this); unwindowButton.setFocusPainted(false); unwindowButton.setContentAreaFilled(false); unwindowButton.setBorderPainted(false); unwindowButton.setPreferredSize(new Dimension(iconSize, iconSize)); // button to insert the view in the main window unwindowButton2 = new JButton(app.getScaledIcon("view-unwindow.png")); unwindowButton2.addActionListener(this); unwindowButton2.setFocusPainted(false); unwindowButton2.setContentAreaFilled(false); unwindowButton2.setBorderPainted(false); unwindowButton2.setPreferredSize(new Dimension(iconSize, iconSize)); // button to display the view in a separate window windowButton = new JButton(app.getScaledIcon("view-window.png")); windowButton.addActionListener(this); windowButton.setFocusPainted(false); windowButton.setContentAreaFilled(false); windowButton.setBorderPainted(false); windowButton.setPreferredSize(new Dimension(iconSize, iconSize)); // button to close the view closeButton = new JButton(app.getScaledIcon("view-close.png")); closeButton.addActionListener(this); closeButton.setFocusPainted(false); closeButton.setPreferredSize(new Dimension(iconSize, iconSize)); // button to toggle maximize/normal state maximizeButton = new JButton(app.getScaledIcon("view-maximize.png")); maximizeButton.addActionListener(this); maximizeButton.setFocusPainted(false); maximizeButton.setPreferredSize(new Dimension(iconSize, iconSize)); }
public Frame(boolean isStar) { super("2048"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); this.isStar = isStar; background = new JLabel(new ImageIcon("Images\\background.png")); this.setResizable(false); add(background); background.setLayout(new FlowLayout()); newGameButton = new JButton(new ImageIcon("Images\\newGame.png")); recordTableButton = new JButton(new ImageIcon("Images\\recordTableButton.png")); designButton = new JButton(new ImageIcon("Images\\changeDesign.png")); newGameButton.setBorder(BorderFactory.createEmptyBorder()); newGameButton.setContentAreaFilled(false); recordTableButton.setBorder(BorderFactory.createEmptyBorder()); recordTableButton.setContentAreaFilled(false); designButton.setBorder(BorderFactory.createEmptyBorder()); designButton.setContentAreaFilled(false); background.add(newGameButton); background.add(recordTableButton); background.add(designButton); newGameButton.addActionListener(this); recordTableButton.addActionListener(this); designButton.addActionListener(this); this.addKeyListener(this); board = new Board(highscores, this); this.pack(); nextImage = new JLabel(new ImageIcon("images\\next2.png")); background.add(board.getBoard()); background.add(nextImage); background.add(board.getScoreLabel()); if (isStar != this.board.getChangedDesign()) { this.board.ChaneDesign(); background.setIcon(new ImageIcon("Images\\Background2.png")); newGameButton.setIcon(new ImageIcon("Images\\newGameStar.png")); recordTableButton.setIcon(new ImageIcon("Images\\recordTableStarButton.png")); designButton.setIcon(new ImageIcon("Images\\changeDesignStar.png")); nextImage.setIcon(new ImageIcon("Images\\next2Star.png")); this.board.getScoreLabel().setText("Stars collected:" + this.board.getScore().getScore()); } // board.ChaneDesign(); this.setSize(476, 570); this.pack(); this.setVisible(true); this.requestFocusInWindow(); }
public FenetreModif(int ID_colis) { this.setTitle("---Resultat du controle---"); this.setSize(250, 300); this.setLocationRelativeTo(null); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.id = ID_colis; updateInfos(); this.setLayout(new BorderLayout()); JPanel champs = new JPanel(); champs.setLayout(new GridLayout(0, 2)); champs.add(labelId_colis); champs.add(colis); champs.add(labelId_commande); champs.add(commande); champs.add(labelDate_emballage); champs.add(date); champs.add(labelStatut); champs.add(stat); // champs.add(labelQualifiant); // champs.add(qual); JPanel button = new JPanel(); ok.setBorderPainted(false); ok.setContentAreaFilled(false); ok.addActionListener(this); annuler.setBorderPainted(false); annuler.setContentAreaFilled(false); annuler.addActionListener(this); button.add(ok); button.add(annuler); this.add(champs, BorderLayout.CENTER); this.add(button, BorderLayout.SOUTH); this.setVisible(true); }
public ProgressDialog(Frame owner, String title) { super(owner, title); openProgressButton.setToolTipText("Console"); openProgressButton.setBackground(Color.WHITE); openProgressButton.setForeground(Color.WHITE); openProgressButton.setIcon( new ImageIcon(DBSGeneralPanel.class.getResource("/img/console.png"))); openProgressButton.setOpaque(false); openProgressButton.setContentAreaFilled(false); openProgressButton.setBorderPainted(false); openProgressButton.setFocusPainted(false); openProgressButton.setVisible( false); // By default set as invisible until collection is executed. progressTextArea.setEditable(false); // this.setLocationRelativeTo(openProgressButton); this.setModalityType(Dialog.ModalityType.valueOf("APPLICATION_MODAL")); this.add(progressScrollPane); this.setSize(1200, 400); openProgressButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { ProgressDialog.this.setLocationRelativeTo(ProgressDialog.this.openProgressButton); ProgressDialog.this.setVisible(true); } }); }
/** * Installs a Tool in the Toolbar * * @param toolbar as JToolbar * @param tool, Tool to install */ public void installToolInToolBar(JToolBar toolbar, final Tool tool) { final JButton button; button = new JButton(); button.setMargin(new Insets(0, 0, 0, 0)); if (tool.getItemType() != null) { button.setIcon(tool.getItemType().getIcon()); button.setToolTipText(tool.getItemType().getDescription()); } else { button.setText("Tool"); // For Debugging } toolbar.add(button); toolButtons.add(button); button.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { WorkingView.this.setTool(tool, button); } }); button.setContentAreaFilled(false); button.setBorderPainted(false); button.addMouseListener( new MouseAdapter() { public void mouseEntered(MouseEvent e) { ((JButton) e.getSource()).setBorderPainted(true); } public void mouseExited(MouseEvent e) { ((JButton) e.getSource()).setBorderPainted(false); } }); }
void setCopyright(String copyright) { Component c = null; if (copyrightUrl == null) { JLabel l = new JLabel("(" + copyright + ")"); c = l; gc.insets.bottom = 0; } else { JButton b = new JButton(copyright != null ? copyright : "Copyright"); b.setFont(b.getFont().deriveFont(Font.ITALIC)); b.setForeground(Color.blue); b.setBackground(background); b.setContentAreaFilled(false); b.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.blue)); b.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { loadCopyright(); } }); c = b; gc.insets.bottom = 5; } gb.setConstraints(c, gc); getPanel().add(c); }
/** * Renvoit le JPanel de gauche, avec le titre du champ. Utilisé dans le cas où il n'y a pas * d'enfants. */ private JPanel getPanelGauche() { panelGauche = new JPanel(new FlowLayout(FlowLayout.LEFT)); final JButton baide = new JButton(new ActionAide(refNoeud)); baide.setFont(baide.getFont().deriveFont((float) 9)); if (System.getProperty("os.name").startsWith("Mac OS")) { baide.setText("?"); if ("10.5".compareTo(System.getProperty("os.version")) <= 0) baide.putClientProperty("JButton.buttonType", "help"); else baide.putClientProperty("JButton.buttonType", "toolbar"); } else { baide.setIcon(new ImageIcon(ImageKeeper.loadImage("images/aide.png"))); baide.setMargin(new Insets(0, 0, 0, 0)); baide.setBorderPainted(false); baide.setContentAreaFilled(false); } String documentation = getDocumentation(); if (documentation != null) baide.setToolTipText(documentation); if (documentation == null && attribut) baide.setEnabled(false); panelGauche.add(baide); labelTitre = new JLabel(getTitre()); if (affParent != null) { if (obligatoire()) labelTitre.setForeground(couleurObligatoire); else labelTitre.setForeground(couleurFacultatif); } panelGauche.add(labelTitre); return (panelGauche); }
/** Panel avec le titre de l'élément, et les boutons d'aide et d'attributs de l'élément */ private JPanel getPanelTitre() { final JButton baide = new JButton(new ActionAide(refNoeud)); baide.setFont(baide.getFont().deriveFont((float) 9)); if (System.getProperty("os.name").startsWith("Mac OS")) { baide.setText("?"); if ("10.5".compareTo(System.getProperty("os.version")) <= 0) baide.putClientProperty("JButton.buttonType", "help"); else baide.putClientProperty("JButton.buttonType", "toolbar"); } else { baide.setIcon(new ImageIcon(ImageKeeper.loadImage("images/aide.png"))); baide.setMargin(new Insets(0, 0, 0, 0)); baide.setBorderPainted(false); baide.setContentAreaFilled(false); } String documentation = getDocumentation(); if (documentation != null) baide.setToolTipText(documentation); final JPanel panelTitre = new JPanel(); panelTitre.add(baide); final JLabel labelTitre = new JLabel(getTitre()); Color couleurTitre; if (affParent != null) { if (obligatoire()) couleurTitre = couleurObligatoire; else couleurTitre = couleurFacultatif; } else couleurTitre = panelEnfants.getForeground(); labelTitre.setForeground(couleurTitre); panelTitre.add(labelTitre); panelTitre.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); final JPanel panelNord = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); panelNord.add(panelTitre); return (panelNord); }
private void showInfo() { clear_all(); JLabel lbl = new JLabel( "<html>Автор идеи - Илья Конжезёров<br>" + "Разработчик - Клим Парпеев<br>" + "Музыка:<ul>" + "<li>Яков Филин – Interlude</li>" + "<li>Duck Sause – NRG</li>" + "<li>Knife Party – EDM Trend Machine</li>" + "<li>Jack U – Take U There (feat. Kiesza)</li>" + "<li>Cash Cash – Kiss the Sky<br></li></ul>" + "Happy Baby Production<br>" + "The NIPEL Inc. (c) 2015</html>"); lbl.setFont(new Font("serif", 0, 25)); lbl.setForeground(Color.WHITE); lbl.setSize(700, 500); lbl.setLocation(Commons.WIDTH / 2 - 700 / 2, 10); add(lbl); JButton back = new JButton("Назад"); back.setSize(190, 75); back.setLocation(Commons.WIDTH / 2 - 190 / 2, Commons.HEIGHT - 150); back.setForeground(Color.GREEN); back.setBorderPainted(false); back.setFocusPainted(false); back.setContentAreaFilled(false); back.setFont(new Font("serif", 0, 40)); back.addActionListener(ev -> showMainMenu()); add(back); repaint(); }
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); }
@Override public JComponent createUI( DescriptionType inputOrOutput, Map<URI, Object> dataMap, Orientation orientation) { // Create the main panel JComponent component = new JPanel(new MigLayout("fill")); boolean isOptional = false; if (inputOrOutput instanceof InputDescriptionType) { isOptional = ((InputDescriptionType) inputOrOutput).getMinOccurs().equals(new BigInteger("0")); } // Display the SourceCA into a JTextField JTextField jtf = new JTextField(); jtf.setToolTipText(inputOrOutput.getAbstract().get(0).getValue()); // "Save" the CA inside the JTextField jtf.getDocument().putProperty(DATA_MAP_PROPERTY, dataMap); URI uri = URI.create(inputOrOutput.getIdentifier().getValue()); jtf.getDocument().putProperty(URI_PROPERTY, uri); // add the listener for the text changes in the JTextField jtf.getDocument() .addDocumentListener( EventHandler.create(DocumentListener.class, this, "saveDocumentText", "document")); if (isOptional) { if (dataMap.containsKey(uri)) { jtf.setText(dataMap.get(uri).toString()); } } GeometryData geometryData = null; if (inputOrOutput instanceof InputDescriptionType) { geometryData = (GeometryData) ((InputDescriptionType) inputOrOutput).getDataDescription().getValue(); } // If the DescriptionType is an output, there is nothing to show, so exit if (geometryData == null) { return null; } component.add(jtf, "growx"); if (orientation.equals(Orientation.VERTICAL)) { JPanel buttonPanel = new JPanel(new MigLayout()); // Create the button Browse JButton pasteButton = new JButton(ToolBoxIcon.getIcon(ToolBoxIcon.PASTE)); // "Save" the sourceCA and the JTextField in the button pasteButton.putClientProperty(TEXT_FIELD_PROPERTY, jtf); pasteButton.setBorderPainted(false); pasteButton.setContentAreaFilled(false); pasteButton.setMargin(new Insets(0, 0, 0, 0)); // Add the listener for the click on the button pasteButton.addActionListener(EventHandler.create(ActionListener.class, this, "onPaste", "")); buttonPanel.add(pasteButton); component.add(buttonPanel, "dock east"); } return component; }
public ButtonCellEditor() { super(); // TODO Auto-generated constructor stub button = new JButton(); button.setContentAreaFilled(false); button.setBorderPainted(false); button.addActionListener(this); }
private void setupButton(JButton button) { button.setOpaque(false); button.setContentAreaFilled(false); button.setBorderPainted(false); button.setForeground(Color.white); button.setHorizontalTextPosition(JButton.CENTER); button.setVerticalTextPosition(JButton.TOP); button.setFont(new Font("Sans Serif", Font.PLAIN, 12)); }
public void setButton(JButton jbtn) { jbtn.setOpaque(false); jbtn.setMargin(new Insets(0, 0, 0, 0)); jbtn.setContentAreaFilled(false); jbtn.setFocusPainted(false); jbtn.setBorderPainted(false); jbtn.setBorder(null); jbtn.addMouseListener(new ButtonListener()); }
@Override public void mouseExited(MouseEvent evt) { if (evt.getSource() instanceof JButton) { JButton button = (JButton) evt.getSource(); if (button.isEnabled()) { button.setContentAreaFilled(false); button.setBorderPainted(false); } } }
private void init() { ImageIcon returnIcon = new ImageIcon("picture/返回.png"); returnButton = new JButton(returnIcon); returnButton.setBounds(662, 575, 48, 48); returnButton.setContentAreaFilled(false); this.setBounds(260, 30, 730, 650); this.setOpaque(false); this.setLayout(null); this.add(returnButton); }
public void setAdditionalProperties() { btLogin.setBorder(null); btLogin.setOpaque(false); btLogin.setContentAreaFilled(false); btLogin.setBorderPainted(false); btLogin.setCursor(new Cursor(Cursor.HAND_CURSOR)); btLogin.setVerticalTextPosition(SwingConstants.BOTTOM); btLogin.setHorizontalTextPosition(SwingConstants.CENTER); btLogin.setPressedIcon(new ImageIcon("files/pix/login.png")); }
protected void initButton(final JButton button, ActionListener listenner) { button.setBorder(BorderFactory.createLineBorder(borderColor)); // button.setFont(new Font("Arial Bold",Font.PLAIN,14)); button.setFont(font); button.setForeground(textColor); button.setIgnoreRepaint(true); button.setFocusable(false); button.setContentAreaFilled(false); button.addActionListener(listenner); }
/** Create the panel. */ public JContact() { // setPreferredSize(new Dimension(10, 10)); setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); JPopupMenu popupMenu = new JPopupMenu(); addPopup(this, popupMenu); JMenuItem mntmInfo = new JMenuItem("info"); popupMenu.add(mntmInfo); setLayout( new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(35dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(47dlu;default)"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("max(23dlu;default)"), })); contactName = new JLabel("ContactName"); add(contactName, "2, 2, 3, 1"); JPanel panel = new JPanel(); add(panel, "2, 4, 3, 1, fill, fill"); panel.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0)); java.net.URL callImageURL = JContact.class.getResource("/com/git/client/ui/ico/phone_small.png"); btnCall = new JButton(new ImageIcon(callImageURL)); btnCall.setContentAreaFilled(false); panel.add(btnCall); java.net.URL delUserImageURL = JContact.class.getResource("/com/git/client/ui/ico/user_delete_small.png"); btnDel = new JButton(new ImageIcon(delUserImageURL)); btnDel.setContentAreaFilled(false); panel.add(btnDel); }
/** Constructor for allocating memory and simple initializing. */ public GameBoard() { dealerPanel = new JPanel(); playerPanel = new JPanel(); controlPanel = new JPanel(); money = new JLabel(); record = new JLabel(); inputImage = new JLabel(new ImageIcon("res/INPUT.gif")); moneyLabel = new JLabel(new ImageIcon("res/MONEY.gif")); betLabel = new JLabel(new ImageIcon("res/MAKE_YOUR_BET.gif")); recordLabel = new JLabel(new ImageIcon("res/BEST_SCORE.gif")); betButton = new JButton(new ImageIcon("res/BET.gif")); resultButton = new JButton(new ImageIcon("res/RESULT.gif")); betInput = new JTextField(); try { recordReader = new BufferedReader(new FileReader("res/record")); bestScore = Integer.parseInt(recordReader.readLine()); recordReader.close(); } catch (Exception e) { e.printStackTrace(); } inputImage.setLayout(new BorderLayout()); controlPanel.setLayout(new FlowLayout()); betInput.setHorizontalAlignment(JTextField.CENTER); betButton.setBorder(BorderFactory.createEmptyBorder()); betButton.setContentAreaFilled(false); resultButton.setBorder(BorderFactory.createEmptyBorder()); resultButton.setContentAreaFilled(false); resultButton.setEnabled(false); betButton.addMouseListener(new BetListener()); resultButton.addMouseListener(new ResultListener()); betInput.setOpaque(false); betInput.setBorder(BorderFactory.createEmptyBorder()); money.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30)); record.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 30)); setOpaque(false); initGame(); initRound(); }
public Abschluss(String wahl, Sudoku s, Sudoku2 s2) { super("Sudoku-Abschluss"); this.setSize(270, 135); this.setLocation(250, 300); this.setLayout(null); this.setAlwaysOnTop(true); this.setResizable(false); this.setUndecorated(true); if (s == null) this.setLocationRelativeTo(s2); else this.setLocationRelativeTo(s); su = s; su2 = s2; w = wahl; ImageIcon icon = new ImageIcon("files/minigames/Sudoku/beispiel2.jpg"); icon.setImage(icon.getImage().getScaledInstance(290, 135, Image.SCALE_DEFAULT)); lab = new JLabel(icon); lab.setSize(270, 135); lab.setLocation(0, 0); this.add(lab); text = new JLabel(); text.setSize(250, 20); text.setLocation(10, 10); text.setForeground(Color.white); text.setHorizontalAlignment(0); lab.add(text); text2 = new JLabel(); text2.setSize(270, 20); text2.setLocation(10, 30); text2.setForeground(Color.white); lab.add(text2); ok = new JButton("OK"); ok.setSize(90, 30); ok.setLocation(80, 50); ok.setBorderPainted(false); ok.setBackground(Color.lightGray); ok.setForeground(Color.lightGray); ok.setOpaque(false); ok.setFont(new Font("Arial Black", 4, 20)); ok.setContentAreaFilled(false); ok.setFocusPainted(false); ok.addActionListener(this); ok.addMouseListener(this); lab.add(ok); textWahl(wahl); this.setVisible(true); }
// 设置向下箭头 @Override protected JButton createIncreaseButton(int orientation) { arrowdown = new JButton(); arrowdown.setIcon(scrollbar_arrowdown_normalIcon); arrowdown.setRolloverIcon(scrollbar_arrowdown_highlightIcon); arrowdown.setPressedIcon(scrollbar_arrowdown_downIcon); arrowdown.setBorderPainted(false); arrowdown.setContentAreaFilled(false); return arrowdown; }
private static JButton createMinimalButton(String icon, String tooltip) { JButton b = new JButton(); BufferedImage image = Resource.loadImage(icon); logger.info("Loading {} for '{}': {}x{}", icon, tooltip, image.getWidth(), image.getHeight()); b.setIcon(new ImageIcon(image)); b.setPreferredSize(new Dimension(16, 16)); b.setToolTipText(tooltip); b.setMargin(new Insets(0, 0, 0, 0)); b.setBorderPainted(false); b.setContentAreaFilled(false); return b; }
public ButtonsRenderer(RemoveButtonComboBox<E> comboBox) { super(new BorderLayout(0, 0)); this.comboBox = comboBox; label.setOpaque(false); setOpaque(true); add(label); deleteButton.setBorder(BorderFactory.createEmptyBorder()); deleteButton.setFocusable(false); deleteButton.setRolloverEnabled(false); deleteButton.setContentAreaFilled(false); add(deleteButton, BorderLayout.EAST); }
public JanelaDoJogo() { setTitle("Space War"); setSize(600, 700); setLocationRelativeTo(null); setResizable(false); ImageIcon imageI = new ImageIcon(getClass().getResource("/Imagens/14bis.png")); final JLabel label = new JLabel(imageI); label.setBounds(0, 0, 600, 700); ImageIcon start = new ImageIcon(getClass().getResource("/Imagens/start.png")); final JPanel painel = new JPanel(); add(painel); painel.add(label); JButton botao = new JButton("", start); botao.setRolloverIcon(start); botao.setPressedIcon(start); botao.setBorderPainted(false); botao.setContentAreaFilled(false); botao.setFocusPainted(false); botao.setBounds(30, 560, 80, 80); botao.setVisible(true); label.add(botao); painel.setVisible(true); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); botao.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { add(new Cenario()); Image cursorImage = Toolkit.getDefaultToolkit().getImage(""); Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImage, new Point(0, 0), ""); setCursor(blankCursor); thread.stop(); painel.setVisible(false); } }); }
protected void createComponents() { main = new JPanel(); main.setLayout(null); int divY = 42; BackgroundPanel div = new BackgroundPanel(hLine); div.setBounds(0, divY, 1920, 2); div.setStyle(BackgroundPanel.SCALED_X); JPanel tools = new JPanel(null); tools.setBounds(0, 0, 800, divY); bNew = new JButton(""); bNew.setIcon(new ImageIcon(newButtonImage)); bNew.setBorderPainted(false); bNew.setBounds(10, 10, newButtonImage.getWidth(null), newButtonImage.getHeight(null)); search = new SearchTextField(searchHint, ElephantWindow.fontMedium); search.setBorder(BorderFactory.createEmptyBorder(0, 22, 0, 20)); search.setBounds(newButtonImage.getWidth(null) + 10, 8, 160, 26); search.setFont(ElephantWindow.fontMedium); search.setFixedColor(Color.decode("#e9e9e9")); search.useV2(); search.windowFocusGained(); trash = new JButton(""); trash.setBorderPainted(false); trash.setContentAreaFilled(false); trash.setIcon(new ImageIcon(noteToolsTrash)); trash.setVisible(this instanceof Notebooks); trash.setBounds( newButtonImage.getWidth(null) + 177, 10, noteToolsTrash.getWidth(null), noteToolsTrash.getHeight(null)); tools.add(bNew); tools.add(search); tools.add(trash); scroll = new JScrollPane(main); scroll.setBorder(ElephantWindow.emptyBorder); scroll.getHorizontalScrollBar().setUnitIncrement(5); scroll.getVerticalScrollBar().setUnitIncrement(5); add(tools); add(div); add(scroll); addComponentListeners(); }
{ rendererEditor = new JButton(MainIconManager.getIcon("error_go")); rendererEditor.setBorderPainted(false); rendererEditor.setContentAreaFilled(false); rendererEditor.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialog.setText(detailsHandlers.getHandler(value).getMessage(value)); dialog.setVisible(true); } }); }
// 下箭头按钮 @Override protected JButton createArrowButton() { arrow = new JButton(""); // ImageIcon increase = new ImageIcon("img/DarkDownArrow.png"); // arrow.setIcon(increase); arrow.setRolloverEnabled(true); // arrow.setRolloverIcon(increase); arrow.setBorder(null); arrow.setBackground(SystemColor.inactiveCaptionBorder); arrow.setOpaque(false); arrow.setContentAreaFilled(false); return arrow; }