public void evaluate() { try { // clear problems and console messages problemsView.setText(""); consoleView.setText(""); // update status view statusView.setText(" Parsing ..."); tabbedPane.setSelectedIndex(0); LispExpr root = Parser.parse(textView.getText()); statusView.setText(" Running ..."); tabbedPane.setSelectedIndex(1); // update run button runButton.setIcon(stopImage); runButton.setActionCommand("Stop"); // start run thread runThread = new RunThread(root); runThread.start(); } catch (SyntaxError e) { tabbedPane.setSelectedIndex(0); System.err.println( "Syntax Error at " + e.getLine() + ", " + e.getColumn() + " : " + e.getMessage()); } catch (Error e) { // parsing error System.err.println(e.getMessage()); statusView.setText(" Errors."); } }
public void createColorPanel() { JPanel colorPanel = new JPanel(new GridLayout(0, 1)); int curRow = 0; for (int i = 0; i < colorString.length / 5; i++) { JPanel row = new JPanel(new GridLayout(1, 0, 2, 1)); row.setBorder(new EmptyBorder(2, 2, 2, 2)); for (int j = curRow; j < curRow + 5; j++) { final JLabel colorLabel = new JLabel(null, new ColoredIcon(color[j], 14, 14), JLabel.CENTER); colorLabel.setOpaque(true); final Border emb = BorderFactory.createEmptyBorder(2, 1, 2, 1); final Border lnb = BorderFactory.createLineBorder(Color.black); final Border cmb = BorderFactory.createCompoundBorder(lnb, emb); colorLabel.setBorder(emb); colorLabel.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { JButton btn = (JButton) getTarget(); Color selColor = ((ColoredIcon) colorLabel.getIcon()).getCurrentColor(); btn.setIcon(new ColoredIcon(selColor)); setVisible(false); btn.doClick(); oldLabel.setBackground(null); colorLabel.setBackground(new Color(150, 150, 200)); colorLabel.setBorder(emb); oldLabel = colorLabel; } public void mouseEntered(MouseEvent e) { colorLabel.setBorder(cmb); colorLabel.setBackground(new Color(150, 150, 200)); } public void mouseExited(MouseEvent e) { colorLabel.setBorder(emb); colorLabel.setBackground(null); } }); row.add(colorLabel); } colorPanel.add(row); curRow += row.getComponentCount(); // System.out.println(curRow); } add(colorPanel, BorderLayout.CENTER); // More Colors Button moreColors = new JButton(new ColorChooserAction((JButton) target)); moreColors.setText("More Colors..."); moreColors.setIcon(null); moreColors.setFont(new Font("Verdana", Font.PLAIN, 10)); // JPanel c = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(moreColors); add(c, BorderLayout.SOUTH); }
public void actionPerformed(ActionEvent e) { if (cChooser == null) { cChooser = new JColorChooser(); } Color color = cChooser.showDialog( target, "Available Colors", ((ColoredIcon) target.getIcon()).getCurrentColor()); target.setIcon(new ColoredIcon(color)); target.doClick(); }
public void runFinished() { // program execution finished so update // status and run button accordingly if (runThread == null) { // _runThread = null only if // execution stopped by user via // run button statusView.setText(" Stopped."); } else { statusView.setText(" Done."); } runButton.setActionCommand("Run"); runButton.setIcon(runImage); }
JButton createButton() { JButton button; if (minimumWidth > 0) { button = new ConstrainedButton(text, minimumWidth); } else { button = new JButton(text); } if (icon != null) { button.setIcon(icon); } if (mnemonic != 0) { button.setMnemonic(mnemonic); } return button; }
public JMovieControlAqua() { // Set the background color to the border color of the buttons. // This way the toolbar won't look too ugly when the buttons // are displayed before they have been loaded completely. // setBackground(new Color(118, 118, 118)); setBackground(Color.WHITE); Dimension buttonSize = new Dimension(16, 16); GridBagLayout gridbag = new GridBagLayout(); Insets margin = new Insets(0, 0, 0, 0); setLayout(gridbag); GridBagConstraints c; ResourceBundle labels = ResourceBundle.getBundle("org.monte.media.Labels"); colorCyclingButton = new JToggleButton(); colorCyclingButton.setToolTipText(labels.getString("colorCycling.toolTipText")); colorCyclingButton.addActionListener(this); colorCyclingButton.setPreferredSize(buttonSize); colorCyclingButton.setMinimumSize(buttonSize); colorCyclingButton.setVisible(false); colorCyclingButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 0; // c.gridy = 0; gridbag.setConstraints(colorCyclingButton, c); add(colorCyclingButton); audioButton = new JToggleButton(); audioButton.setToolTipText(labels.getString("audio.toolTipText")); audioButton.addActionListener(this); audioButton.setPreferredSize(buttonSize); audioButton.setMinimumSize(buttonSize); audioButton.setVisible(false); audioButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 0; // c.gridy = 0; gridbag.setConstraints(audioButton, c); add(audioButton); startButton = new JToggleButton(); startButton.setToolTipText(labels.getString("play.toolTipText")); startButton.addActionListener(this); startButton.setPreferredSize(buttonSize); startButton.setMinimumSize(buttonSize); startButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 1; // c.gridy = 0; gridbag.setConstraints(startButton, c); add(startButton); slider = new JMovieSliderAqua(); c = new GridBagConstraints(); // c.gridx = 2; // c.gridy = 0; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; gridbag.setConstraints(slider, c); add(slider); rewindButton = new JButton(); rewindButton.setToolTipText(labels.getString("previous.toolTipText")); rewindButton.setPreferredSize(buttonSize); rewindButton.setMinimumSize(buttonSize); rewindButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 3; // c.gridy = 0; gridbag.setConstraints(rewindButton, c); add(rewindButton); rewindButton.addActionListener(this); forwardButton = new JButton(); forwardButton.setToolTipText(labels.getString("next.toolTipText")); buttonSize = new Dimension(17, 16); forwardButton.setPreferredSize(buttonSize); forwardButton.setMinimumSize(buttonSize); forwardButton.setMargin(margin); c = new GridBagConstraints(); // c.gridx = 4; // c.gridy = 0; gridbag.setConstraints(forwardButton, c); add(forwardButton); forwardButton.addActionListener(this); // The spacer is used when the play controls are hidden spacer = new JPanel(new BorderLayout()); spacer.setVisible(false); spacer.setPreferredSize(new Dimension(16, 16)); spacer.setMinimumSize(new Dimension(16, 16)); spacer.setOpaque(false); c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; gridbag.setConstraints(spacer, c); add(spacer); Border border = new BackdropBorder( new ButtonStateBorder( new ImageBevelBorder( Images.createImage(getClass(), "images/Player.border.png"), new Insets(1, 1, 1, 1), new Insets(0, 4, 1, 4)), new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderP.png"), new Insets(1, 1, 1, 1), new Insets(0, 4, 1, 4)))); Border westBorder = new BackdropBorder( new ButtonStateBorder( new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderWest.png"), new Insets(1, 1, 1, 0), new Insets(0, 4, 1, 4)), new ImageBevelBorder( Images.createImage(getClass(), "images/Player.borderWestP.png"), new Insets(1, 1, 1, 0), new Insets(0, 4, 1, 4)))); startButton.setBorder(westBorder); colorCyclingButton.setBorder(westBorder); audioButton.setBorder(westBorder); rewindButton.setBorder(westBorder); forwardButton.setBorder(border); startButton.setUI((ButtonUI) CustomButtonUI.createUI(startButton)); colorCyclingButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton)); audioButton.setUI((ButtonUI) CustomButtonUI.createUI(audioButton)); rewindButton.setUI((ButtonUI) CustomButtonUI.createUI(rewindButton)); forwardButton.setUI((ButtonUI) CustomButtonUI.createUI(forwardButton)); colorCyclingButton.setIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png"))); colorCyclingButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartColorCycling.png"))); colorCyclingButton.setDisabledIcon( new ImageIcon( Images.createImage(getClass(), "images/PlayerStartColorCycling.disabled.png"))); audioButton.setIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.png"))); audioButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStopAudio.png"))); audioButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStartAudio.disabled.png"))); startButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.png"))); startButton.setSelectedIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStop.png"))); startButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerStart.disabled.png"))); rewindButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.png"))); rewindButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerBack.disabled.png"))); forwardButton.setIcon(new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.png"))); forwardButton.setDisabledIcon( new ImageIcon(Images.createImage(getClass(), "images/PlayerNext.disabled.png"))); // Automatic scrolling scrollHandler = new ScrollHandler(); scrollTimer = new Timer(60, scrollHandler); scrollTimer.setInitialDelay(300); // default InitialDelay? forwardButton.addMouseListener(scrollHandler); rewindButton.addMouseListener(scrollHandler); }
/** Reloads search button icon. */ public void loadSkin() { searchButton.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.SEARCH_ICON))); }
public void actionPerformed(ActionEvent event) { if (posicion == -2) posicion = indexaux; // Abrir nueva imagen if (event.getSource() == carpeta) { siguiente.setEnabled(true); atras.setEnabled(true); presentacion.setEnabled(true); grid.setEnabled(true); bcomentario.setEnabled(true); zoom.setEnabled(true); imagenesbean.clear(); if (imagenes != null) { imagenes.clear(); } returnChooser = chooser.showOpenDialog(ArcViewer.this); imagenes = lista.Miranda(chooser, returnChooser); for (int asd1 = 0; asd1 < imagenes.size(); asd1++) { imagenesbean.add(new ImagenBean(imagenes.get(asd1), 0, 0)); } String getImgSelected = chooser.getSelectedFile().getPath(); for (int index = 0; index < imagenesbean.size(); index++) { if (getImgSelected.equals(imagenesbean.get(index).getIcon())) { imagen.setIcon(new ImageIcon(imagenesbean.get(index).getIcon())); indexaux = index; } } } // Imagen siguiente if (event.getSource() == siguiente) { posicion++; if (posicion >= imagenesbean.size()) { posicion = 0; } imagen.setIcon( ajustar.ajusteImg( new ImageIcon(imagenesbean.get(posicion).getIcon()), imagenesbean.get(posicion).getAncho(), imagenesbean.get(posicion).getAlto(), areaventana.getWidth() - 50, areaventana.getHeight())); } // Imagen anterior if (event.getSource() == atras) { posicion--; if (posicion == -1) { posicion = imagenesbean.size() - 1; } imagen.setIcon( ajustar.ajusteImg( new ImageIcon(imagenesbean.get(posicion).getIcon()), imagenesbean.get(posicion).getAncho(), imagenesbean.get(posicion).getAlto(), areaventana.getWidth() - 50, areaventana.getHeight())); } // Presentacion iniciar/detener if (event.getSource() == presentacion) { if (isPresentacion == false) { grid.setVisible(false); atras.setVisible(false); siguiente.setVisible(false); carpeta.setVisible(false); bcomentario.setVisible(false); zoom.setVisible(false); ptiempo.setVisible(true); } if (isPresentacion == true) { grid.setVisible(true); atras.setVisible(true); siguiente.setVisible(true); carpeta.setVisible(true); bcomentario.setVisible(true); zoom.setVisible(true); ptiempo.setVisible(false); } if (presentacion.getIcon() == imgPausa) { slide.detener(); posicion = slide.getPosicion(); presentacion.setIcon(imgPlay); isPresentacion = false; return; } if (presentacion.getIcon() == imgPlay) { slide.setTodo(posicion, imagen, imagenesbean, areaventana, ptiempo); new Thread(slide, "prueba").start(); presentacion.setIcon(imgPausa); isPresentacion = true; return; } } // Modo rejilla if (event.getSource() == grid) { imagen.setVisible(false); siguiente.setVisible(false); atras.setVisible(false); presentacion.setVisible(false); grid.setVisible(false); bcomentario.setVisible(false); zoom.setVisible(false); carpeta.setVisible(false); ptiempo.setVisible(false); // desplazamiento.setVisible(true); if (corrobora == true) { for (int celular = 0; celular < imgButtonArray.length; celular++) { imgButtonArray[celular].setVisible(true); } } if (corrobora == false) { imgButtonArray = new JButton[imagenesbean.size()]; for (int goku = 0; goku < imagenesbean.size(); goku++) { areaventana.add(imgButtonArray[goku] = new JButton()); imgButtonArray[goku].setPreferredSize(new Dimension(200, 200)); imgButtonArray[goku].addActionListener(this); imgButtonArray[goku].setBackground(colorGris); imgButtonArray[goku].setIcon( ajustar.ajusteCuadrado(new ImageIcon(imagenesbean.get(goku).getIcon()))); corrobora = true; } } } // Comentario if (event.getSource() == bcomentario) { new Comentario(imagenesbean.get(posicion), posicion); } // Cuando se apreta un boton de la rejilla if (corrobora == true) { for (int alice = 0; alice < imgButtonArray.length; alice++) { if (event.getSource() == imgButtonArray[alice]) { for (int wonderland = 0; wonderland < imgButtonArray.length; wonderland++) { imgButtonArray[wonderland].setVisible(false); } posicion = alice; imagen.setIcon( ajustar.ajusteImg( new ImageIcon(imagenesbean.get(posicion).getIcon()), imagenesbean.get(posicion).getAncho(), imagenesbean.get(posicion).getAlto(), areaventana.getWidth() - 50, areaventana.getHeight())); imagen.setVisible(true); siguiente.setVisible(true); atras.setVisible(true); presentacion.setVisible(true); grid.setVisible(true); bcomentario.setVisible(true); zoom.setVisible(true); carpeta.setVisible(true); } } } if (event.getSource() == zoom) { System.out.println("Haciendo un ZOOOOOOOOOOOOM"); } }
public SmartToolBar(RuntimeConfigFrame fr) { frame = fr; setFloatable(true); treeCombo = new TreeCombo(frame.model); treeCombo.addActionListener(new ComboListener()); treeCombo.setPreferredSize(new Dimension(210, 25)); treeCombo.setMinimumSize(new Dimension(210, 25)); treeCombo.setMaximumSize(new Dimension(210, 25)); add(treeCombo); addSeparator(); addSeparator(); addSeparator(); ToolBarAction toolBarAction = new ToolBarAction(); JButton saveAsButton = add(toolBarAction); ImageIcon icon = frame .getCommonBuilderUIImpl() .getScaledImage("file.png", "images/runtimeadmin", 28, 28, Image.SCALE_DEFAULT); saveAsButton.setPreferredSize(new Dimension(28, 28)); saveAsButton.setMinimumSize(new Dimension(28, 28)); saveAsButton.setMaximumSize(new Dimension(28, 28)); saveAsButton.setBorderPainted(false); saveAsButton.setIcon(icon); icon = frame .getCommonBuilderUIImpl() .getScaledImage("file_mo.png", "images/runtimeadmin", 28, 28, Image.SCALE_DEFAULT); saveAsButton.setRolloverIcon(icon); saveAsButton.setActionCommand("Apply To Server"); saveAsButton.setToolTipText(RuntimeConfigFrame.getString("Apply To Server")); addSeparator(); JButton close = add(toolBarAction); icon = frame .getCommonBuilderUIImpl() .getScaledImage("exit.png", "images/", 28, 28, Image.SCALE_DEFAULT); close.setPreferredSize(new Dimension(28, 28)); close.setMinimumSize(new Dimension(28, 28)); close.setMaximumSize(new Dimension(28, 28)); close.setIcon(icon); close.setBorderPainted(false); icon = frame .getCommonBuilderUIImpl() .getScaledImage("exit_mo.png", "images/", 28, 28, Image.SCALE_DEFAULT); close.setRolloverIcon(icon); close.setActionCommand("Close"); close.setToolTipText(RuntimeConfigFrame.getString("Close")); addSeparator(); JButton help = add(toolBarAction); icon = frame .getCommonBuilderUIImpl() .getScaledImage("toolhelp.png", "images/", 28, 28, Image.SCALE_DEFAULT); help.setPreferredSize(new Dimension(28, 28)); help.setMinimumSize(new Dimension(28, 28)); help.setMaximumSize(new Dimension(28, 28)); help.setBorderPainted(false); help.setIcon(icon); icon = frame .getCommonBuilderUIImpl() .getScaledImage("toolhelp_mo.png", "images/", 28, 28, Image.SCALE_DEFAULT); help.setRolloverIcon(icon); help.setActionCommand("Help Contents"); help.setToolTipText(RuntimeConfigFrame.getString("Help")); // addSeparator(); }
public void setSelectedColor(Color color) { selectedColor = new ColoredIcon(color); back.setIcon(selectedColor); }