Java Code Examples for javax.swing.ImageIcon

The following are top voted examples for showing how to use javax.swing.ImageIcon. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: zooracle   File: OpenCVUtils.java   Source Code and License 8 votes vote down vote up
/**
 * Display image in a frame
 *
 * @param title
 * @param img
 */
public static void imshow(String title, Mat img) {
	 
    
    // Convert image Mat to a jpeg
    MatOfByte imageBytes = new MatOfByte();
    Highgui.imencode(".jpg", img, imageBytes);
    
    try {
        // Put the jpeg bytes into a JFrame window and show.
        JFrame frame = new JFrame(title);
        frame.getContentPane().add(new JLabel(new ImageIcon(ImageIO.read(new ByteArrayInputStream(imageBytes.toArray())))));
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
        frame.setLocation(30 + (windowNo*20), 30 + (windowNo*20));
        windowNo++;
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 2
Project: SER316-Munich   File: App.java   Source Code and License 7 votes vote down vote up
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel l = new JLabel();
	l.setSize(400, 300);
	l.setIcon(spl);
	splash.getContentPane().add(l);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 3
Project: Neukoelln_SER316   File: TaskTreeTableCellRenderer.java   Source Code and License 6 votes vote down vote up
public static ImageIcon getPriorityIcon(Task t) {
    switch (t.getPriority()) {
    case Task.PRIORITY_NORMAL:
        return PR_NORMAL_ICON;
    case Task.PRIORITY_HIGHEST:
        return PR_HIGHEST_ICON;
    case Task.PRIORITY_HIGH:
        return PR_HIGH_ICON;
    case Task.PRIORITY_LOW:
        return PR_LOW_ICON;
    case Task.PRIORITY_LOWEST:
        return PR_LOWEST_ICON;
    }
    System.err.println("Problem finding priority icon");
    return null;
}
 
Example 4
Project: code-sentinel   File: RunCentralisedMAS.java   Source Code and License 6 votes vote down vote up
protected void createPauseButton() {
    final JButton btPause = new JButton("Pause", new ImageIcon(RunCentralisedMAS.class.getResource("/images/resume_co.gif")));
    btPause.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            if (MASConsoleGUI.get().isPause()) {
                btPause.setText("Pause");
                MASConsoleGUI.get().setPause(false);
            } else {
                btPause.setText("Continue");
                MASConsoleGUI.get().setPause(true);
            }

        }
    });
    MASConsoleGUI.get().addButton(btPause);
}
 
Example 5
Project: PPRCarTrade   File: TelaVenda.java   Source Code and License 6 votes vote down vote up
private void btn_CarregarImagemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CarregarImagemActionPerformed
    // TODO add your handling code here:
    JFileChooser fc = new JFileChooser();
    FileFilter imageFilter = new FileNameExtensionFilter("Image files", ImageIO.getReaderFileSuffixes());
    fc.setFileFilter(imageFilter);
    int result = fc.showOpenDialog(null);
    if(result == JFileChooser.APPROVE_OPTION){
        try {
            String path = fc.getSelectedFile().getAbsolutePath();
            imagens.add(new ImageIcon(path));
            JOptionPane.showMessageDialog(this, "Imagem carregada com sucesso!");
        } catch(Exception e){
            JOptionPane.showMessageDialog(null, "Ocorreu um erro ao carregar a imagem!", "Erro", JOptionPane.ERROR_MESSAGE);
        }            
    }
}
 
Example 6
Project: FreeCol   File: QuickActionMenu.java   Source Code and License 6 votes vote down vote up
/**
 * Creates menu items for some goods in a market.
 *
 * @param marketLabel The {@code MarketLabel} to create entries for.
 */
private void createMarketMenu(MarketLabel marketLabel) {
    final AbstractGoods ag = marketLabel.getAbstractGoods();
    final Player player = freeColClient.getMyPlayer();

    this.setLabel(Messages.message("cargo"));
    JMenuItem name = new JMenuItem(
        Messages.getName(ag) + " (" + Messages.message("colopedia") + ")",
        new ImageIcon(
            gui.getImageLibrary().getSmallIconImage(ag.getType())));
    name.addActionListener((ActionEvent ae) -> {
            gui.showColopediaPanel(ag.getType().getId());
        });
    this.add(name);

    final Europe europe = this.freeColClient.getMyPlayer().getEurope();
    addMarketItems(ag, europe);

    if (!player.canTrade(ag.getType())) {
        addPayArrears(ag.getType());
    }
}
 
Example 7
Project: openvisualtraceroute   File: WWJPanel.java   Source Code and License 6 votes vote down vote up
/**
 * Highlight the given annotation
 *
 * @param annotation
 * @param point
 */
private void highlightAnnotation(final LabeledPath label, final GeoPoint point) {
	final ScreenAnnotation annotation = label.getAnnotation();
	if (_lastSelection != null) {
		final LabeledPath lastSelectedLabel = _lastSelection.getLeft();
		final ScreenAnnotation lastSelectedAnnotation = lastSelectedLabel.getAnnotation();
		final GeoPoint lastSelectedPoint = _lastSelection.getRight();
		if (_mapShowLabel) {
			lastSelectedAnnotation.setAttributes(createAnnotationAttr(false, lastSelectedPoint.getCountryFlag(IMAGE_RESOLUTION), getText(lastSelectedPoint)));
			lastSelectedAnnotation.setAlwaysOnTop(false);
		} else {
			_renderableLayer.removeRenderable(lastSelectedLabel);
		}
	}
	final ImageIcon image = point.getCountryFlag(IMAGE_RESOLUTION);
	final String text = getText(point);
	annotation.setAttributes(createAnnotationAttr(true, image, text));
	annotation.setAlwaysOnTop(true);
	if (!_mapShowLabel) {
		_renderableLayer.addRenderable(label);
		_controller.redraw();
	}
	_lastSelection = Pair.of(label, point);
}
 
Example 8
Project: rapidminer   File: Item.java   Source Code and License 6 votes vote down vote up
private ImageIcon getThumbnailIcon() {
	if (this.thumbIcon == null) {
		if (this.isDirectory) {
			this.thumbIcon = getBigSystemIcon();
		} else {
			try {
				this.thumbIcon = new ImageIcon(Tools.getScaledInstance(this.file));
				if (this.thumbIcon == null) {
					this.thumbIcon = getBigSystemIcon();
				}
			} catch (Exception ex) {
				this.thumbIcon = getBigSystemIcon();
			}
		}
	}
	return this.thumbIcon;
}
 
Example 9
Project: 2D-Elliptic-Mesh-Generator   File: PlotPanel.java   Source Code and License 6 votes vote down vote up
public void toGraphicFile(File file) throws IOException {
    // otherwise toolbar appears
    plotToolBar.setVisible(false);

    Image image = createImage(getWidth(), getHeight());
    paint(image.getGraphics());
    image = new ImageIcon(image).getImage();

    BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics g = bufferedImage.createGraphics();
    g.drawImage(image, 0, 0, Color.WHITE, null);
    g.dispose();

    // make it reappear
    plotToolBar.setVisible(true);

    try {
        ImageIO.write((RenderedImage) bufferedImage, "PNG", file);
    } catch (IllegalArgumentException ex) {
    }
}
 
Example 10
Project: SER316-Aachen   File: App.java   Source Code and License 6 votes vote down vote up
/**
 * Method showSplash.
 */
private void showSplash() {
	splash = new JFrame();
	ImageIcon spl =
		new ImageIcon(App.class.getResource("resources/splash.png"));
	JLabel l = new JLabel();
	l.setSize(400, 300);
	l.setIcon(spl);
	splash.getContentPane().add(l);
	splash.setSize(400, 300);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	splash.setLocation(
		(screenSize.width - 400) / 2,
		(screenSize.height - 300) / 2);
	splash.setUndecorated(true);
	splash.setVisible(true);
}
 
Example 11
Project: rapidminer   File: Tools.java   Source Code and License 6 votes vote down vote up
public static ImageIcon getSmallSystemIcon(Image img) throws Exception {
	if (img.getWidth(null) > 20 || img.getHeight(null) > 20) {
		if (img.getWidth(null) > img.getHeight(null)) {
			width = 18;
			height = img.getHeight(null) * 18 / img.getWidth(null);
		} else {
			height = 18;
			width = img.getWidth(null) * 18 / img.getHeight(null);
		}
	} else {
		return new ImageIcon(img);
	}

	dest = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
	dest2 = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);

	g = dest.getGraphics();
	g.drawImage(img, 1, 1, width, height, null);

	g.dispose();

	blurOperator.filter(dest, dest2);

	return new ImageIcon(dest2);
}
 
Example 12
Project: LightSIP   File: TabbedPaneDemo.java   Source Code and License 6 votes vote down vote up
public TabbedPaneDemo() {
    ImageIcon icon = new ImageIcon("images/middle.gif");
    JTabbedPane tabbedPane = new JTabbedPane();

    Component panel1 = makeTextPanel("Blah");
    tabbedPane.addTab("One", icon, panel1, "Does nothing");
    tabbedPane.setSelectedIndex(0);

    Component panel2 = makeTextPanel("Blah blah");
    tabbedPane.addTab("Two", icon, panel2, "Does twice as much nothing");

    Component panel3 = makeTextPanel("Blah blah blah");
    tabbedPane.addTab("Three", icon, panel3, "Still does nothing");

    Component panel4 = makeTextPanel("Blah blah blah blah");
    tabbedPane.addTab("Four", icon, panel4, "Does nothing at all");

    //Add the tabbed pane to this panel.
    setLayout(new GridLayout(1, 1));
    add(tabbedPane);
}
 
Example 13
Project: Wilmersdorf_SER316   File: TaskTreeTableCellRenderer.java   Source Code and License 6 votes vote down vote up
public static ImageIcon getPriorityIcon(Task t) {
    switch (t.getPriority()) {
    case Task.PRIORITY_NORMAL:
        return PR_NORMAL_ICON;
    case Task.PRIORITY_HIGHEST:
        return PR_HIGHEST_ICON;
    case Task.PRIORITY_HIGH:
        return PR_HIGH_ICON;
    case Task.PRIORITY_LOW:
        return PR_LOW_ICON;
    case Task.PRIORITY_LOWEST:
        return PR_LOWEST_ICON;
    }
    System.err.println("Problem finding priority icon");
    return null;
}
 
Example 14
Project: JuggleMasterPro   File: PreferencesDialogJButton.java   Source Code and License 6 votes vote down vote up
final public void doLoadImages() {

		int intLiconFile =
							this.bolGresetPreferences ? Constants.intS_FILE_ICON_RESET_BW
														: this.bolGsavePreferences ? this.bolGcloseDialog ? Constants.intS_FILE_ICON_OK_BW
																											: Constants.intS_FILE_ICON_APPLY_BW
																					: this.bolGcloseDialog ? Constants.intS_FILE_ICON_CANCEL_BW
																											: Constants.intS_FILE_ICON_RESTORE_BW;
		final ImageIcon icoL = this.objGcontrolJFrame.getJuggleMasterPro().getImageIcon(intLiconFile, 2);

		intLiconFile =
						this.bolGresetPreferences ? Constants.intS_FILE_ICON_RESET
													: this.bolGsavePreferences ? this.bolGcloseDialog ? Constants.intS_FILE_ICON_OK
																										: Constants.intS_FILE_ICON_APPLY
																				: this.bolGcloseDialog ? Constants.intS_FILE_ICON_CANCEL
																										: Constants.intS_FILE_ICON_RESTORE;
		final ImageIcon icoLrollOver = this.objGcontrolJFrame.getJuggleMasterPro().getImageIcon(intLiconFile, 2);

		Tools.setIcons(this, icoL, icoLrollOver);
	}
 
Example 15
Project: Hotel-Properties-Management-System   File: LanguageCmbBox.java   Source Code and License 6 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
		boolean cellHasFocus) {
	

	int selectedIndex = ((Integer) value).intValue();

	if (isSelected) {
		setBackground(list.getSelectionBackground());
		setForeground(list.getSelectionForeground());
	} else {
		setBackground(list.getBackground());
		setForeground(list.getForeground());
	}

	ImageIcon icon = iconArray[selectedIndex];
	setIcon(icon);
	
	return this;
}
 
Example 16
Project: Dahlem_SER316   File: TaskTreeTableCellRenderer.java   Source Code and License 6 votes vote down vote up
public static ImageIcon getStatusIcon(Task t) {
    switch (t.getStatus(CurrentDate.get())) {
    case Task.ACTIVE:
        return TASK_ACTIVE_ICON;
    case Task.SCHEDULED:
        return TASK_SCHEDULED_ICON;
    case Task.DEADLINE:
        return TASK_DEADLINE_ICON;
    case Task.OVERDUE:
        return TASK_FAILED_ICON;
    case Task.COMPLETED:
        return TASK_COMPLETED_ICON;
    }
    System.err.println("Problem finding status icon");
    return null;
}
 
Example 17
Project: trashjam2017   File: Hiero.java   Source Code and License 5 votes vote down vote up
static Icon getColorIcon (java.awt.Color color) {
	BufferedImage image = new BufferedImage(32, 16, BufferedImage.TYPE_INT_RGB);
	java.awt.Graphics g = image.getGraphics();
	g.setColor(color);
	g.fillRect(1, 1, 30, 14);
	g.setColor(java.awt.Color.black);
	g.drawRect(0, 0, 31, 15);
	return new ImageIcon(image);
}
 
Example 18
Project: Neukoelln_SER316   File: ImagePreview.java   Source Code and License 5 votes vote down vote up
public void loadImage() {
    if (file == null) {
        return;
    }

    ImageIcon tmpIcon = new ImageIcon(file.getPath());
    if (tmpIcon.getIconWidth() > 90) {
        thumbnail = new ImageIcon(tmpIcon.getImage().
                             getScaledInstance(90, -1,
                                               Image.SCALE_DEFAULT));
    } else {
        thumbnail = tmpIcon;
    }
}
 
Example 19
Project: powertext   File: AutoCompleteDescWindow.java   Source Code and License 5 votes vote down vote up
public ToolBarBackAction(boolean ltr) {
	String img = "org/fife/ui/autocomplete/arrow_" +
				(ltr ? "left.png" : "right.png");
	ClassLoader cl = getClass().getClassLoader();
	Icon icon = new ImageIcon(cl.getResource(img));
	putValue(Action.SMALL_ICON, icon);
}
 
Example 20
Project: ramus   File: ExcelPlugin.java   Source Code and License 5 votes vote down vote up
public ExportToExcelAction(TableView tableView) {
    this.tableView = tableView;
    putValue(ACTION_COMMAND_KEY, "Action.ExportToExcel");
    putValue(ACTION_STRING_GETTER, ExcelPlugin.this);
    putValue(SMALL_ICON, new ImageIcon(getClass().getResource(
            "/com/ramussoft/excel/export-to-excel.png")));
}
 
Example 21
Project: ramus   File: ModelsPanel.java   Source Code and License 5 votes vote down vote up
private void init() {
    treeModel.setRoot(createRoot());

    tree = new JTree(treeModel) {
        @Override
        public TreeCellRenderer getCellRenderer() {
            TreeCellRenderer renderer = super.getCellRenderer();
            if (renderer == null)
                return null;
            ((DefaultTreeCellRenderer) renderer).setLeafIcon(new ImageIcon(
                    getClass().getResource("/images/function.png")));
            return renderer;
        }
    };

    tree.setCellRenderer(new Renderer());

    tree.setEditable(true);

    tree.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if ((e.getButton() == MouseEvent.BUTTON1)
                    && (e.getClickCount() == 2)) {
                openDiagram();
            }
        }

    });

    tree.setRootVisible(true);

    JScrollPane pane = new JScrollPane();
    pane.setViewportView(tree);
    this.add(pane, BorderLayout.CENTER);
}
 
Example 22
Project: Weather-Forecast   File: WeatherImp.java   Source Code and License 5 votes vote down vote up
public ImageIcon WeatherIcon(final String dscription, boolean flag) {
    if (dscription.contains(WeatherDescription.Clouds)) {
        return new ImageIcon(getClass().getResource(WeatherDescription.CloudIcon100PX));
    } else if (dscription.contains(WeatherDescription.Rain)) {
        return new ImageIcon(getClass().getResource(WeatherDescription.RainIcon100PX));
    } else if (dscription.contains(WeatherDescription.Snow)) {
        return new ImageIcon(getClass().getResource(WeatherDescription.SnowIcon100PX));
    } else if (dscription.contains(WeatherDescription.Clear)) {
        return new ImageIcon(getClass().getResource(WeatherDescription.SunIcon100PX));
    } else {
        return null;
    }
}
 
Example 23
Project: freecol   File: GoodsLabel.java   Source Code and License 5 votes vote down vote up
/**
 * Set whether only a partial amount is to be selected.
 *
 * @param partialChosen The new partial choice.
 */
@Override
public void setPartialChosen(boolean partialChosen) {
    super.setPartialChosen(partialChosen);
    ImageLibrary lib = gui.getImageLibrary();
    Image image = partialChosen
                  ? lib.getSmallIconImage(getType())
                  : lib.getIconImage(getType());
    setIcon(new ImageIcon(image));
}
 
Example 24
Project: ramus   File: OtherElementTableCellEditor.java   Source Code and License 5 votes vote down vote up
private JButton createEditButton() {
    JButton edit = new JButton();
    edit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            edit();
        }
    });
    edit.setIcon(new ImageIcon(getClass().getResource(
            "/com/ramussoft/gui/edit.png")));
    edit.setToolTipText(GlobalResourcesManager.getString("edit"));
    edit.setFocusable(false);
    edit.setPreferredSize(new Dimension(16, 16));
    return edit;
}
 
Example 25
Project: defense-solutions-proofs-of-concept   File: BasemapWidget.java   Source Code and License 5 votes vote down vote up
public BasemapWidget(BasemapLayer layer, ButtonGroup buttonGroup) {
    initComponents();
    this.layer = layer;
    if (layer.getLayer().isVisible()) {
        jToggleButton_showBasemap.setSelected(true);
        jToggleButton_showBasemap.setBorder(BORDER_SELECTED);
    } else {
        jToggleButton_showBasemap.setBorder(BORDER_UNSELECTED);
    }
    jLabel_label.setText("<html>" + layer.getLayer().getName() + "</html>");
    
    Icon icon = layer.getThumbnail();
    if (null == icon) {
        icon = guessIconForLayerName(layer.getLayer().getName());
    }
    if (null != icon) {
        if (null != icon && icon instanceof ImageIcon) {
            ImageIcon imageIcon = (ImageIcon) icon;
            icon = Utilities.rescale(imageIcon, jToggleButton_showBasemap.getPreferredSize(), this);
        }
        jToggleButton_showBasemap.setIcon(icon);
    }
    
    setSize(getLayout().preferredLayoutSize(this));
    
    buttonGroup.add(jToggleButton_showBasemap);
}
 
Example 26
Project: Pixie   File: BoundingBoxWindow.java   Source Code and License 5 votes vote down vote up
/**
 * Display the image with the segmented box.
 */
private void showImage() {
    // resize image with the ratio relative to the original image, in order to prevent data loose
    workImg = resize.resizeImage(origImg);

    // if the image was highlighted, do it again
    if (HISTO_ORIGINAL.equals(jBHistogramEq.getText())) {
        workImg = Utils.histogramEqColor(workImg);
    }

    // get the graphics of the image
    Graphics2D g2d = workImg.createGraphics();

    if ((currentObject instanceof ObjectBBox) || (currentObject instanceof ObjectScribble)) {
        // draw the outer box of the object
        Rectangle bBox = drawOuterBox(g2d);

        // display the object map if the object is scribble
        displayObjMap(bBox);

    } else if (currentObject instanceof ObjectPolygon) {
        // draw the polygon object
        drawPolygon(g2d);
    }

    g2d.dispose();

    // display the image
    ImageIcon iconLogo = new ImageIcon(workImg);
    jLImagePreview.setIcon(iconLogo);
}
 
Example 27
Project: ramus   File: PrintPreviewComponent.java   Source Code and License 5 votes vote down vote up
public PageSetupAction() {
    super(GlobalResourcesManager.getString("Action.PageSetup"));
    putValue(
            SMALL_ICON,
            new ImageIcon(getClass().getResource(
                    "/com/ramussoft/gui/page-setup.png")));
    putValue(ACTION_COMMAND_KEY, "Action.PageSetup");
    putValue(SHORT_DESCRIPTION,
            GlobalResourcesManager.getString("Action.PageSetup"));
}
 
Example 28
Project: pm-home-station   File: LabelObserver.java   Source Code and License 5 votes vote down vote up
@Override
public void disconnected() {
    btnConnect.setText("Connect");
    deviceStatus.setText("Status: Device sensor disconnected");
    if (icon != null) {
        icon.setIcon(new ImageIcon(disconnectedIcon.getScaledInstance(icon.getIcon().getIconWidth(), -1, Image.SCALE_SMOOTH)));
    }
}
 
Example 29
Project: Tarski   File: mxGraphComponent.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
public void setBackgroundImage(ImageIcon value) {
  ImageIcon oldValue = backgroundImage;
  backgroundImage = value;

  firePropertyChange("backgroundImage", oldValue, backgroundImage);
}
 
Example 30
Project: ramus   File: TableEditor.java   Source Code and License 5 votes vote down vote up
public MoveToOtherElementAction() {
    putValue(ACTION_COMMAND_KEY,
            "Action.MoveTableElementToOtherElement");
    putValue(
            SMALL_ICON,
            new ImageIcon(
                    getClass()
                            .getResource(
                                    "/com/ramussoft/gui/table/move-table-element-to-other-element.png")));
    setEnabled(false);
}
 
Example 31
Project: FreeCol   File: SwingGUI.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public boolean confirm(Tile tile, StringTemplate template, Unit unit,
                       String okKey, String cancelKey) {
    return canvas.showConfirmDialog(tile,
        Utility.localizedTextArea(template),
        new ImageIcon(imageLibrary.getUnitImage(unit)),
        okKey, cancelKey);
}
 
Example 32
Project: ProyectoPacientes   File: JDagEspecialidad.java   Source Code and License 5 votes vote down vote up
private void btnAgregarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btnAgregarKeyPressed
    // TODO add your handling code here:
    String cc = this.cc.getText();
    String ee = this.ee.getText();
    if(cc.length()==0||ee.length()==0)
    {
        JOptionPane.showMessageDialog(null, "Los registros no pueden estar vacios\nPor favor llene los registros", "Advertencia", JOptionPane.WARNING_MESSAGE);
        this.cc.requestFocus();
    }
    else
    {
        if(cc.length()>50||ee.length()>50)
        {
            JOptionPane.showMessageDialog(null, "El numero de caracteres permitido es de 50", "Advertencia", JOptionPane.WARNING_MESSAGE);
            this.cc.requestFocus();
        }
        else
        {
            AsignarEsp asignar = new AsignarEsp();
            Icon i = new ImageIcon(getClass().getResource("/Imagenes/Aceptar.jpg"));
            JOptionPane.showMessageDialog(null,asignar.AgregarEspecialidad(this.cc.getText(), this.ee.getText()),"Mensaje",JOptionPane.INFORMATION_MESSAGE, i);
            LLenarCombo llenar = new LLenarCombo();
            llenar.LimpiarCombo(AsignarEspecialidad.Combo);
            llenar.Presentar(AsignarEspecialidad.Combo);
            this.hide();
        }
    }
}
 
Example 33
Project: incubator-netbeans   File: EditableDisplayerTest.java   Source Code and License 5 votes vote down vote up
/** Asserts that a pixel at a given position in an image matches a
 * pixel in a given position in a component */
private synchronized void assertPixelFromImage(String msg, final Image i, final Component c, final int imageX, final int imageY, final int compX, final int compY) throws Exception {
    final BufferedImage bi = i instanceof BufferedImage ? (BufferedImage) i : toBufferedImage(i);
    throwMe = null;
    sleep();
    
    int rgb = bi.getRGB(imageX, imageY);
    Color color = new Color(rgb);
    
    
    //uncomment the code below for diagnosing painting problems
    //and seeing which pixel you'return really checking
    JFrame jf = new JFrame("assertPixelFromImage " + count + " (look for the yellow line)") {
        public void paint(Graphics g) {
            new ImageIcon(bi).paintIcon(this, g, 25, 25);
            g.setColor(Color.YELLOW);
            g.drawLine(imageX+20, imageY+25, imageX+25, imageY+25);
        }
    };
    jf.setLocation(500,500);
    jf.setSize(100,100);
    jf.show();
    
    try {
        assertPixel(msg, c, color, compX, compY);
    } catch (Exception e) {
        throwMe = e;
    }
    if (throwMe != null) {
        throw throwMe;
    }
}
 
Example 34
Project: SUAPPasswordResetter   File: Login.java   Source Code and License 5 votes vote down vote up
private void logar() {
    if (campoUsuario.equals("") || campoSenha.equals("")) {
        JOptionPane.showMessageDialog(null, "Campos matrícula ou senha não devem estar vazios.", "Atenção", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(Toolkit.getDefaultToolkit().getImage("icon/64.png")));
    } else {
        Aguarde a = new Aguarde(null, false);
        a.setAlwaysOnTop(true);
        a.setVisible(true);

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                Servidor servidor = new Servidor(campoUsuario.getText(), String.valueOf(campoSenha.getPassword()));
                Suap s = new Suap(servidor);

                try {
                    if (s.verificarCredenciais()) {
                        setVisible(false);
                        a.setVisible(false);
                    } else {
                        a.setVisible(false);
                        JOptionPane.showMessageDialog(Login.this, "Credenciais inválidas.");
                    }
                } catch (Exception ex) {
                    JOptionPane.showMessageDialog(Login.this, ex.getMessage());
                }
            }
        });

    }
}
 
Example 35
Project: org.alloytools.alloy   File: OurUtil.java   Source Code and License 5 votes vote down vote up
/**
 * Load the given image file from an accompanying JAR file, and return it as
 * an Icon object.
 */
public static Icon loadIcon(String pathname) {
	URL url = OurUtil.class.getClassLoader().getResource(pathname);
	if (url != null)
		return new ImageIcon(Toolkit.getDefaultToolkit().createImage(url));
	return new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB));
}
 
Example 36
Project: FreeCol   File: ReportCompactColonyPanel.java   Source Code and License 5 votes vote down vote up
private List<JButton> unitButtons(final Map<UnitType, Suggestion> suggestions,
                                  List<UnitType> have, Colony colony) {
    final String cac = colony.getId();
    List<JButton> result = new ArrayList<>();
    final Comparator<UnitType> buttonComparator
        = Comparator.comparing(ut -> suggestions.get(ut),
                               Suggestion.descendingAmountComparator);
    for (UnitType type : sort(suggestions.keySet(), buttonComparator)) {
        boolean present = have.contains(type);
        Suggestion suggestion = suggestions.get(type);
        String label = Integer.toString(suggestion.amount);
        ImageIcon icon
            = new ImageIcon(this.lib.getTinyUnitImage(type, false));
        StringTemplate tip = (suggestion.oldType == null)
            ? stpld("report.colony.wanting")
                .addName("%colony%", colony.getName())
                .addNamed("%unit%", type)
                .addStringTemplate("%location%",
                    suggestion.workLocation.getLabel())
                .addNamed("%goods%", suggestion.goodsType)
                .addAmount("%amount%", suggestion.amount)
            : stpld("report.colony.improving")
                .addName("%colony%", colony.getName())
                .addNamed("%oldUnit%", suggestion.oldType)
                .addNamed("%unit%", type)
                .addStringTemplate("%location%",
                    suggestion.workLocation.getLabel())
                .addNamed("%goods%", suggestion.goodsType)
                .addAmount("%amount%", suggestion.amount);
        JButton b = newButton(cac, label, icon,
                              (present) ? cGood : cPlain, tip);
        if (present) b.setFont(b.getFont().deriveFont(Font.BOLD));
        result.add(b);
    }
    return result;
}
 
Example 37
Project: java-course   File: TabComponent.java   Source Code and License 5 votes vote down vote up
/**
 * Constructor for TabComponent class.
 * 
 * @param pane
 *            {@link JTabbedPane} parent component.
 * @param observer
 *            Main JNotepadPP frame.
 * @param lp
 *            Localization provider.
 */
public TabComponent(JTabbedPane pane, JNotepadPP observer,
        ILocalizationProvider lp) {

    super(new FlowLayout(FlowLayout.LEFT, 0, 0));
    this.lp = lp;
    this.observer = observer;
    setOpaque(false);

    JLabel label = new JLabel() {
        private static final long serialVersionUID = 1L;

        public String getText() {
            int i = pane.indexOfTabComponent(TabComponent.this);
            if (i != -1) {
                this.revalidate();
                return pane.getTitleAt(i);

            }
            return "";
        }
    };

    ImageIcon image = new ImageIcon(this.getClass().getResource(
            "res/green.png"));
    picLabel = new JLabel(image);
    add(picLabel);
    add(label);

    picLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    closeButton = new CloseTabButton(this);
    add(closeButton);

    setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
}
 
Example 38
Project: Equella   File: GResourceSelector.java   Source Code and License 5 votes vote down vote up
@Override
public JComponent generateControl()
{
	field = new JTextField();
	field.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));

	if( items.size() >= 1 )
	{
		field.setText(((Item) items.get(0)).getValue());
	}

	JButton browse = new JButton("Browse");
	browse.setIcon(new ImageIcon(getClass().getResource("/images/browse.gif")));
	browse.setHorizontalTextPosition(SwingConstants.RIGHT);
	Dimension browseSize = browse.getPreferredSize();
	browseSize.height = 20;
	browse.setMaximumSize(browseSize);
	browse.addActionListener(this);

	JPanel group = new JPanel();
	group.setLayout(new BoxLayout(group, BoxLayout.X_AXIS));
	group.add(field);
	group.add(Box.createRigidArea(new Dimension(5, 0)));
	group.add(browse);
	group.setAlignmentX(Component.LEFT_ALIGNMENT);

	return group;
}
 
Example 39
Project: Cognizant-Intelligent-Test-Scripter   File: BaseEditor.java   Source Code and License 5 votes vote down vote up
private BaseEditor() {

        this.setUndecorated(this.isUndecorated());
        initComponents();
        this.setIconImage(new ImageIcon(getClass().getResource("/explorer/explorer.png")).getImage());
        this.setBackground(new Color(255, 255, 255, 0));
        this.setAlwaysOnTop(true);
        add(slider);

    }
 
Example 40
Project: jaer   File: RNNfilter.java   Source Code and License 5 votes vote down vote up
/**
 * Converts the arraylist holding the recorded features and prints it as an
 * image in a new JFrame
 *
 * @param input
 * @throws IOException
 */
public void printDigit(ArrayList<int[]> input) throws IOException {
    if (input.isEmpty()) {
        return;
    }
    int xLength = input.size();
    int yLength = input.get(0).length;
    int maxValue = 0;
    int[][] tmpImage = new int[xLength][yLength];
    for (int i = 0; i < xLength; i++) {
        tmpImage[i] = input.get(i);
    }
    maxValue = RNNfilter.maxValueIn2DArray(tmpImage);
    int[][] tmpImageScaled = RNNfilter.rescale2DArray(tmpImage, 255 / maxValue);
    BufferedImage newImage = new BufferedImage(xLength, yLength, BufferedImage.TYPE_INT_RGB);
    for (int x = 0; x < xLength; x++) {
        for (int y = 0; y < yLength; y++) {
            newImage.setRGB(x, y, tmpImageScaled[x][y]);
        }
    }
    ImageIcon icon = new ImageIcon(newImage);
    ScaledImagePanel scaledImage = new ScaledImagePanel(icon);
    JFrame frame = new JFrame();
    frame.setSize(xLength, yLength);
    frame.add(scaledImage);
    frame.setVisible(true);

}
 
Example 41
Project: marathonv5   File: JTabbedPaneJavaElementTest.java   Source Code and License 5 votes vote down vote up
protected static ImageIcon createImageIcon(String path) {
    java.net.URL imgURL = TabbedPaneDemo.class.getResource(path);
    if (imgURL != null) {
        return new ImageIcon(imgURL);
    } else {
        System.err.println("Couldn't find file: " + path);
        return null;
    }
}
 
Example 42
Project: incubator-netbeans   File: TargetExecutor.java   Source Code and License 5 votes vote down vote up
@Override
public Object getValue(String key) {
    if (key.equals(Action.SMALL_ICON)) {
        return new ImageIcon(TargetExecutor.class.getResource("/org/apache/tools/ant/module/resources/options.png"));
    } else if (key.equals(Action.SHORT_DESCRIPTION)) {
        return NbBundle.getMessage(TargetExecutor.class, "TargetExecutor.OptionsAction");
    } else {
        return super.getValue(key);
    }
}
 
Example 43
Project: projetomcdonalds   File: Inicial.java   Source Code and License 5 votes vote down vote up
/**
 * Creates new form Main
 */
public Inicial() {
    initComponents();
    this.setLocationRelativeTo(null);

    setIcon();

    ImageIcon img = new javax.swing.ImageIcon("C:\\Users\\Public\\Pictures\\telaFundo.png");
    img.setImage(img.getImage().getScaledInstance(617, 447, 100));

    lbl_imagem.setIcon(img);
}
 
Example 44
Project: SER316-Dresden   File: AppFrame_AboutBox.java   Source Code and License 5 votes vote down vote up
/**
 * Initializes GUI with text, images, text, buttons, etc.
 * @throws Exception
 */
private void jbInit() throws Exception  {    
  String text = "<html>";
  text += "<b>"+product+"</b><br><br>";
  text += copyright + "<br>" + url + "<br><br>";
  text += "<b>" + developersHead + "</b><br>";    
  for (int i = 0; i < developers.length; i++)
      text += developers[i]+"<br>";    
  text += "<br><b>" + othersHead + "</b><br>";    
  for (int i = 0; i < others.length; i++)
      text += others[i]+"<br>"; 
  
  text += "</html>";
  
  image = new ImageIcon(AppFrame_AboutBox.class.getResource("/ui/memoranda.png"));
  this.setTitle(Local.getString("About Memoranda"));
  setResizable(false);
  // Initialize Objects
  lblText.setFont(new java.awt.Font("Dialog", 0, 11));
  lblText.setText(text);
  lblText.setBounds(10, 55, 300, 400);

  
  button1.setText(Local.getString("Ok"));
  button1.setBounds(150, 415, 95, 30);
  button1.addActionListener(this);
  button1.setPreferredSize(new Dimension(95, 30));
  button1.setBackground(ColorMap.OKBNBG);
  button1.setForeground(ColorMap.OKBNFG);
  layeredPane = getLayeredPane();
  //layeredPane.setPreferredSize(new Dimension(300, 300));
  imgLabel = new JLabel(image);
  imgLabel.setBounds(0, 0, image.getIconWidth(), image.getIconHeight());
  layeredPane.add(imgLabel, new Integer(1));
  layeredPane.add(lblText, new Integer(2));    
  layeredPane.add(button1, new Integer(2));
  this.getContentPane().setBackground(ColorMap.POPBG);
}
 
Example 45
Project: Clipcon-Client   File: TrayIconManager.java   Source Code and License 5 votes vote down vote up
public TrayIconManager() {
	trayIconImageURL = Main.class.getResource("/resources/trayIcon.png");
	trayIconImageIcon = new ImageIcon(trayIconImageURL);
	trayIconImage = trayIconImageIcon.getImage();
	trayIconMenu = new PopupMenu();
	trayIcon = new TrayIcon(trayIconImage, "ClipCon", trayIconMenu);
}
 
Example 46
Project: Progetto-B   File: CardListener.java   Source Code and License 5 votes vote down vote up
/**
 * When the cursor hovers over a card, the card is moved to the front.
 *
 * @param e
 */
@Override
public void mouseEntered(MouseEvent e) {
    if (game.getPhase().equals(PLAY_CARDS)) {
        JLabel label = (JLabel) e.getComponent();
        cardPanel.getCardsPane().setLayer(label, 1);
        String card = (String) label.getClientProperty("name");
        label.setIcon(new ImageIcon("src/resources/images/" + card + "_BLACK.png"));
        Point p = label.getLocation();
        Point p1 = new Point(p.x, HIGH_Y);
        label.setLocation(p1);
        cardPanel.updateUI();
    }
}
 
Example 47
Project: cognitive-services-java-computer-vision-tutorial   File: MainFrame.java   Source Code and License 5 votes vote down vote up
/**
 * Scales the given image to fit the label dimensions.
 * @param bImage: The image to fit.
 * @param label: The label to display the image.
 */
private void scaleAndShowImage(BufferedImage bImage, JLabel label) {
    int bImageHeight = bImage.getHeight();
    int bImageWidth = bImage.getWidth();
    int labelHeight = label.getHeight();
    int labelWidth = label.getWidth();
    
    // Does this need to be scaled?
    if (labelHeight >= bImageHeight && labelWidth >= bImageWidth) {
        // If not, display the image and return.
        ImageIcon image = new ImageIcon(bImage);
        label.setIcon(image);
        return;
    }
    
    // Calculate the new width and height for the image.
    int newHeight;
    int newWidth;
    double bImageAspect = (double)bImageHeight / (double)bImageWidth;
    double labelAspect = (double)labelHeight / (double)labelWidth;
    
    if (bImageAspect > labelAspect) {
        newHeight = labelHeight;
        newWidth = (int)(((double)labelHeight / (double)bImageHeight) * (double)bImageWidth);
    } else {
        newWidth = labelWidth;
        newHeight = (int)(((double)labelWidth / (double)bImageWidth) * (double)bImageHeight);
    }
    
    // Create a new image scaled to the correct size.
    Image newImage = bImage.getScaledInstance(newWidth, newHeight, Image.SCALE_SMOOTH);
    
    // Display the scaled image.
    ImageIcon labelImage = new ImageIcon(newImage);
    label.setIcon(labelImage);
    label.validate();
    label.repaint();
}
 
Example 48
Project: jdk8u-jdk   File: StyleSheet.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the ImageIcon to draw in the background for
 * <code>attr</code>.
 */
ImageIcon getBackgroundImage(AttributeSet attr) {
    Object value = attr.getAttribute(CSS.Attribute.BACKGROUND_IMAGE);

    if (value != null) {
        return ((CSS.BackgroundImage)value).getImage(getBase());
    }
    return null;
}
 
Example 49
Project: Tarski   File: EditorPalette.java   Source Code and License 5 votes vote down vote up
/**
 * 
 * @param name
 * @param icon
 * @param style
 * @param width
 * @param height
 * @param value
 */
public void addEdgeTemplate(final String name, ImageIcon icon, String style, int width,
    int height, Object value) {
  mxGeometry geometry = new mxGeometry(0, 0, width, height);
  geometry.setTerminalPoint(new mxPoint(0, height), true);
  geometry.setTerminalPoint(new mxPoint(width, 0), false);
  geometry.setRelative(true);

  mxCell cell = new mxCell(value, geometry, style);
  cell.setEdge(true);

  addTemplate(name, icon, cell);
}
 
Example 50
Project: FreeCol   File: ReportCompactColonyPanel.java   Source Code and License 5 votes vote down vote up
/**
 * Display the header area for the concise panel.
 *
 * @param market A {@code Market} to check goods arrears
 *     status with.
 */
private void conciseHeaders(Market market) {
    reportPanel.add(new JSeparator(JSeparator.HORIZONTAL),
                    "newline, span, growx");

    reportPanel.add(newLabel("report.colony.name.header", null, null,
                             stpld("report.colony.name")),
                    "newline");

    reportPanel.add(newLabel("report.colony.grow.header", null, null,
                             stpld("report.colony.grow")));
    reportPanel.add(newLabel("report.colony.explore.header", null, null,
                             stpld("report.colony.explore")));
    for (TileImprovementType ti : this.spec.getTileImprovementTypeList()) {
        if (ti.isNatural()) continue;
        String key = "report.colony.tile." + ti.getSuffix() + ".header";
        reportPanel.add(newLabel(key, null, null, stpld(key)));
    }
    for (GoodsType gt : this.goodsTypes) {
        ImageIcon icon = new ImageIcon(this.lib.getSmallIconImage(gt));
        JLabel l = newLabel(null, icon, null,
                            stpl("report.colony.production.header")
                                .addNamed("%goods%", gt));
        l.setEnabled(market == null || market.getArrears(gt) <= 0);
        reportPanel.add(l);
    }

    final UnitType type = spec.getDefaultUnitType(getMyPlayer());
    ImageIcon colonistIcon
        = new ImageIcon(this.lib.getTinyUnitImage(type, false));
    reportPanel.add(newLabel(null, colonistIcon, null,
                             stpld("report.colony.birth")));
    reportPanel.add(newLabel("report.colony.making.header", null, null,
                             stpld("report.colony.making")));
    reportPanel.add(newLabel("report.colony.improve.header", null, null,
                             stpld("report.colony.improve")));

    reportPanel.add(new JSeparator(JSeparator.HORIZONTAL),
                    "newline, span, growx");
}
 
Example 51
Project: freecol   File: MainPanel.java   Source Code and License 5 votes vote down vote up
/**
 * The constructor that will add the items to this panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public MainPanel(FreeColClient freeColClient) {
    super(freeColClient, new MigLayout("wrap 1, insets n n 20 n",
                                       "[center]"));

    boolean canContinue = FreeColDirectories
        .getLastSaveGameFile() != null;

    ActionManager am = getFreeColClient().getActionManager();
    JButton newButton = new JButton(am.getFreeColAction(NewAction.id));
    JButton openButton = new JButton(am.getFreeColAction(OpenAction.id));
    JButton mapEditorButton = new JButton(am.getFreeColAction(MapEditorAction.id));
    JButton optionsButton = new JButton(am.getFreeColAction(PreferencesAction.id));
    JButton aboutButton = new JButton(am.getFreeColAction(AboutAction.id));
    JButton quitButton = new JButton(am.getFreeColAction(QuitAction.id));

    setCancelComponent(quitButton);
    okButton.setAction(am.getFreeColAction((canContinue)
            ? ContinueAction.id
            : NewAction.id));

    Image tempImage = ResourceManager.getImage("image.flavor.Title");
    JLabel logoLabel = new JLabel(new ImageIcon(tempImage));
    logoLabel.setBorder(new CompoundBorder(new EmptyBorder(2,2,0,2),
            new BevelBorder(BevelBorder.LOWERED)));
    add(logoLabel);

    add(okButton, "newline 20, width 70%");
    if (canContinue) add(newButton, "width 70%");
    add(openButton, "width 70%");
    add(mapEditorButton, "width 70%");
    add(optionsButton, "width 70%");
    add(aboutButton, "width 70%");
    add(quitButton, "width 70%");

    setSize(getPreferredSize());
}
 
Example 52
Project: manifold-ij   File: ManFrameworkType.java   Source Code and License 4 votes vote down vote up
@NotNull
@Override
public Icon getIcon()
{
  return new ImageIcon( getClass().getResource( "/manifold/ij/icons/manifold_20.png" ) );
}
 
Example 53
Project: Snake-Ladder   File: Main.java   Source Code and License 4 votes vote down vote up
/**
 * Create the frame.
 */



//point ta Random number create kore return kore. and dice er pic show kore
public void Dice(){
	Random rn = new Random();

	point = rn.nextInt(6)+1;
	//point=chokkaTest();

	String dice = String.valueOf(point);
	String location = "/Image/dice "+dice+".jpg";
	lblDimage.setIcon(new ImageIcon(Main.class.getResource(location)));   //player er disk board e boshay

	if(point==1) flag[player-1]=1;      //gutir chal 1 hoile she khela shuru korte parbe
	if(flag[player-1]==1)movedisc();
	//System.out.println("Dice: "+dice);
	
}
 
Example 54
Project: fuck_zookeeper   File: ZooInspectorIconResources.java   Source Code and License 4 votes vote down vote up
/**
 * @return node viewers icon
 */
public static ImageIcon getChangeNodeViewersIcon() {
    return new ImageIcon("icons/edtsrclkup_co.gif"); //$NON-NLS-1$
}
 
Example 55
Project: ramus   File: UndoRedoPlugin.java   Source Code and License 4 votes vote down vote up
private ImageIcon getIcon(String resourceName) {
    return new ImageIcon(getClass().getResource(resourceName));
}
 
Example 56
Project: FreeCol   File: AboutPanel.java   Source Code and License 4 votes vote down vote up
/**
 * The constructor that will add the items to this panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public AboutPanel(FreeColClient freeColClient) {
    super(freeColClient, new MigLayout("wrap"));

    // Header with image
    Image tempImage = ResourceManager.getImage("image.flavor.Title");
    JLabel apLogoLabel = new JLabel(new ImageIcon(tempImage));
    apLogoLabel.setBorder(
        new CompoundBorder(new EmptyBorder(2,2,2,2),
                           new BevelBorder(BevelBorder.LOWERED)));
    add(apLogoLabel, "center");

    // Create available Font choices
    Font fontBold = FontLibrary.createFont(FontLibrary.FontType.NORMAL,
        FontLibrary.FontSize.TINY, Font.BOLD,
        getImageLibrary().getScaleFactor());
    Font fontNormal = FontLibrary.createFont(FontLibrary.FontType.NORMAL,
        FontLibrary.FontSize.TINY, getImageLibrary().getScaleFactor());

    // Version
    JLabel apVersion = Utility.localizedLabel("aboutPanel.version");
    apVersion.setFont(fontBold);
    JLabel apRevision = new JLabel(FreeCol.getRevision());
    apRevision.setFont(fontNormal);
    add(apVersion, "newline 20");
    add(apRevision, "newline");

    // Official Site Link
    JLabel apOfficialSite = Utility.localizedLabel("aboutPanel.officialSite");
    apOfficialSite.setFont(fontBold);
    add(apOfficialSite, "newline 10");
    JButton apSiteURL = Utility.getLinkButton(SITE_URL, null, SITE_URL);
    apSiteURL.addActionListener(this);
    apSiteURL.setFont(fontNormal);
    add(apSiteURL, "newline");

    // SourceForge Project Site Link
    JLabel apSFProject = Utility.localizedLabel("aboutPanel.sfProject");
    apSFProject.setFont(fontBold);
    add(apSFProject, "newline 10");
    JButton apProjectURL = Utility.getLinkButton(PROJECT_URL, null, PROJECT_URL);
    apProjectURL.addActionListener(this);
    apProjectURL.setFont(fontNormal);
    add(apProjectURL, "newline");

    // Manual
    JLabel apManual = Utility.localizedLabel("aboutPanel.manual");
    apManual.setFont(fontBold);
    add(apManual, "newline 10");
    JButton apManualURL = Utility.getLinkButton(MANUAL_URL, null,
                                                MANUAL_URL);
    apManualURL.addActionListener(this);
    add(apManualURL, "newline");

    // License Disclaimer
    JTextArea apLegal = Utility.localizedTextArea("aboutPanel.legalDisclaimer");
    apLegal.setFont(fontNormal);
    add(apLegal, "newline 20, width 300px");

    // Copyright
    JLabel apCopyright = Utility.localizedLabel("aboutPanel.copyright");
    apCopyright.setFont(fontNormal);
    add(apCopyright, "newline 10");

    add(okButton, "newline 20, tag ok");
}
 
Example 57
Project: PengueeBot   File: JLabelToggle.java   Source Code and License 4 votes vote down vote up
public void setIcon(ImageIcon ii) {
	super.setIcon(ii);
	unselectedIcon = ii;
}
 
Example 58
Project: smile_1.5.0_java7   File: PlotCanvas.java   Source Code and License 4 votes vote down vote up
public ZoomOutAction() {
    super("Zoom Out", new ImageIcon(PlotCanvas.class.getResource("images/zoom-out16.png")));
}
 
Example 59
Project: Equella   File: JStatusBar.java   Source Code and License 4 votes vote down vote up
/**
 * Constructs a new status bar. Message and Spinner locations default to
 * left
 */
public JStatusBar(ImageIcon image)
{
	this(image, SwingConstants.LEFT, SwingConstants.LEFT);
}
 
Example 60
Project: Library-app   File: AcercaDe.java   Source Code and License 4 votes vote down vote up
/**
 * Create the frame.
 */
public AcercaDe(JFrame principal) {
	setIconImage(Toolkit.getDefaultToolkit().getImage(AcercaDe.class.getResource("/biblioteca/images/book.png")));
	this.principal=principal;
	principal.setEnabled(false);
	
	setTitle("Acerca de Biblioteca 2017");
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 332, 330);
	setLocationRelativeTo(null);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	JTextPane txtpnHola = new JTextPane();
	txtpnHola.setForeground(Color.WHITE);
	txtpnHola.setEditable(false);
	txtpnHola.setBackground(Color.BLACK);
	txtpnHola.setText("Biblioteca 2017 \u00A9 Juan Delgado Salmer\u00F3n");
	txtpnHola.setBounds(10, 11, 311, 20);
	contentPane.add(txtpnHola);
	
	JTextPane txtpnVersinBuild = new JTextPane();
	txtpnVersinBuild.setForeground(Color.WHITE);
	txtpnVersinBuild.setEditable(false);
	txtpnVersinBuild.setText("Versi\u00F3n 1.1.0\r\nBuild 20170516-5000");
	txtpnVersinBuild.setBackground(Color.BLACK);
	txtpnVersinBuild.setBounds(10, 42, 311, 34);
	contentPane.add(txtpnVersinBuild);
	
	JTextPane txtpnCopyrightBiblioteca = new JTextPane();
	txtpnCopyrightBiblioteca.setForeground(Color.WHITE);
	txtpnCopyrightBiblioteca.setEditable(false);
	txtpnCopyrightBiblioteca.setText("Copyright 2017 Biblioteca 2017 creado por Juan Delgado Salmer\u00F3n. Todos los derechos reservados por JunDev.\r\nEsta aplicaci\u00F3n tiene open-source los primeros 24 d\u00EDas de su distribuci\u00F3n, despu\u00E9s de dicha fecha se cobrar\u00E1n 200\u20AC por ella.");
	txtpnCopyrightBiblioteca.setBackground(Color.BLACK);
	txtpnCopyrightBiblioteca.setBounds(10, 98, 311, 109);
	contentPane.add(txtpnCopyrightBiblioteca);
	
	JLabel lblImage = new JLabel("");
	lblImage.setIcon(new ImageIcon(AcercaDe.class.getResource("/biblioteca/images/jundev.png")));
	lblImage.setBounds(10, 214, 311, 79);
	contentPane.add(lblImage);
	
	JPanel panel = new JPanel();
	panel.setBackground(Color.BLACK);
	panel.setBounds(0, 0, 331, 304);
	contentPane.add(panel);
	
	setVisible(true);
	addWindowListener(this);
	setResizable(false);
}