Java 类javax.swing.ImageIcon 实例源码

项目:Neukoelln_SER316    文件:TaskTreeTableCellRenderer.java   
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;
}
项目:code-sentinel    文件:RunCentralisedMAS.java   
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);
}
项目:PPRCarTrade    文件:TelaVenda.java   
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);
        }            
    }
}
项目:SER316-Munich    文件:App.java   
/**
 * 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);
}
项目:FreeCol    文件:QuickActionMenu.java   
/**
 * 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());
    }
}
项目:openvisualtraceroute    文件:WWJPanel.java   
/**
 * 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);
}
项目:rapidminer    文件:Item.java   
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;
}
项目:2D-Elliptic-Mesh-Generator    文件:PlotPanel.java   
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) {
    }
}
项目:SER316-Aachen    文件:App.java   
/**
 * 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);
}
项目:zooracle    文件:OpenCVUtils.java   
/**
 * 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();
    }
}
项目:rapidminer    文件:Tools.java   
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);
}
项目:LightSIP    文件:TabbedPaneDemo.java   
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);
}
项目:Wilmersdorf_SER316    文件:TaskTreeTableCellRenderer.java   
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;
}
项目:JuggleMasterPro    文件:PreferencesDialogJButton.java   
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);
    }
项目:Hotel-Properties-Management-System    文件:LanguageCmbBox.java   
@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;
}
项目:Dahlem_SER316    文件:TaskTreeTableCellRenderer.java   
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;
}
项目:trashjam2017    文件:Hiero.java   
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);
}
项目:Neukoelln_SER316    文件:ImagePreview.java   
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;
    }
}
项目:powertext    文件:AutoCompleteDescWindow.java   
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);
}
项目:ramus    文件:ExcelPlugin.java   
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")));
}
项目:ramus    文件:ModelsPanel.java   
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);
}
项目:Weather-Forecast    文件:WeatherImp.java   
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;
    }
}
项目:freecol    文件:GoodsLabel.java   
/**
 * 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));
}
项目:ramus    文件:OtherElementTableCellEditor.java   
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;
}
项目:defense-solutions-proofs-of-concept    文件:BasemapWidget.java   
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);
}
项目:Pixie    文件:BoundingBoxWindow.java   
/**
 * 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);
}
项目:ramus    文件:PrintPreviewComponent.java   
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"));
}
项目:pm-home-station    文件:LabelObserver.java   
@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)));
    }
}
项目:Tarski    文件:mxGraphComponent.java   
/**
 * 
 */
public void setBackgroundImage(ImageIcon value) {
  ImageIcon oldValue = backgroundImage;
  backgroundImage = value;

  firePropertyChange("backgroundImage", oldValue, backgroundImage);
}
项目:ramus    文件:TableEditor.java   
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);
}
项目:FreeCol    文件:SwingGUI.java   
/**
 * {@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);
}
项目:ProyectoPacientes    文件:JDagEspecialidad.java   
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();
        }
    }
}
项目:incubator-netbeans    文件:EditableDisplayerTest.java   
/** 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;
    }
}
项目:SUAPPasswordResetter    文件:Login.java   
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());
                }
            }
        });

    }
}
项目:org.alloytools.alloy    文件:OurUtil.java   
/**
 * 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));
}
项目:FreeCol    文件:ReportCompactColonyPanel.java   
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;
}
项目:java-course    文件:TabComponent.java   
/**
 * 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));
}
项目:Equella    文件:GResourceSelector.java   
@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;
}
项目:Cognizant-Intelligent-Test-Scripter    文件:BaseEditor.java   
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);

    }
项目:jaer    文件:RNNfilter.java   
/**
 * 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);

}