List of usage examples for javax.swing ImageIcon ImageIcon
public ImageIcon(byte[] imageData)
From source file:it.unibas.spicygui.controllo.tree.ActionShowHideJoinConditions.java
public ActionShowHideJoinConditions() { this.executeInjection(); this.putValue(NAME, NbBundle.getMessage(Costanti.class, Costanti.ACTION_SHOW_HIDE_JOIN_CONDITIONS)); this.putValue(SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(Costanti.ICONA_SHOW_HIDE_JOIN_CONDITIONS))); this.putValue(Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_J)); this.setEnabled(false); registraAzione();// w w w . ja v a 2 s. c o m }
From source file:io.warp10.script.processing.image.Pdecode.java
@Override public Object apply(WarpScriptStack stack) throws WarpScriptException { Object top = stack.pop();// www.ja v a 2 s.com String data = top.toString(); if (!(top instanceof String) || !data.startsWith("data:image/")) { throw new WarpScriptException(getName() + " expects a base64 data URI on top of the stack."); } data = data.substring(data.indexOf(",") + 1); byte[] bytes = Base64.decodeBase64(data); Image awtImage = new ImageIcon(bytes).getImage(); if (awtImage instanceof BufferedImage) { BufferedImage buffImage = (BufferedImage) awtImage; int space = buffImage.getColorModel().getColorSpace().getType(); if (space == ColorSpace.TYPE_CMYK) { throw new WarpScriptException(getName() + " only supports RGB images."); } } PImage image = new PImage(awtImage); // // Check transparency // if (null != image.pixels) { for (int i = 0; i < image.pixels.length; i++) { // since transparency is often at corners, hopefully this // will find a non-transparent pixel quickly and exit if ((image.pixels[i] & 0xff000000) != 0xff000000) { image.format = PImage.ARGB; break; } } } stack.push(image); return stack; }
From source file:fr.pasteque.pos.sales.restaurant.Floor.java
public Floor(JSONObject o) { this.m_sID = o.getString("id"); this.m_sName = o.getString("label"); // TODO restore background image BufferedImage img = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB); ThumbNailBuilder tnbcat = new ThumbNailBuilder(32, 32, defimg); m_container = new JPanelDrawing(img); m_icon = new ImageIcon(tnbcat.getThumbNail(img)); }
From source file:TabbedPaneTest.java
public TabbedPaneFrame() { setTitle("TabbedPaneTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); tabbedPane = new JTabbedPane(); // we set the components to null and delay their loading until the tab is shown // for the first time ImageIcon icon = new ImageIcon("yellow-ball.gif"); tabbedPane.addTab("Mercury", icon, null); tabbedPane.addTab("Venus", icon, null); tabbedPane.addTab("Earth", icon, null); tabbedPane.addTab("Mars", icon, null); tabbedPane.addTab("Jupiter", icon, null); tabbedPane.addTab("Saturn", icon, null); tabbedPane.addTab("Uranus", icon, null); tabbedPane.addTab("Neptune", icon, null); tabbedPane.addTab("Pluto", null, null); final int plutoIndex = tabbedPane.indexOfTab("Pluto"); JPanel plutoPanel = new JPanel(); plutoPanel.add(new JLabel("Pluto", icon, SwingConstants.LEADING)); JToggleButton plutoCheckBox = new JCheckBox(); plutoCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tabbedPane.remove(plutoIndex); }// w w w . j a v a 2 s . c om }); plutoPanel.add(plutoCheckBox); tabbedPane.setTabComponentAt(plutoIndex, plutoPanel); add(tabbedPane, "Center"); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent event) { // check if this tab still has a null component if (tabbedPane.getSelectedComponent() == null) { // set the component to the image icon int n = tabbedPane.getSelectedIndex(); loadTab(n); } } }); loadTab(0); JPanel buttonPanel = new JPanel(); ButtonGroup buttonGroup = new ButtonGroup(); JRadioButton wrapButton = new JRadioButton("Wrap tabs"); wrapButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { tabbedPane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT); } }); buttonPanel.add(wrapButton); buttonGroup.add(wrapButton); wrapButton.setSelected(true); JRadioButton scrollButton = new JRadioButton("Scroll tabs"); scrollButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } }); buttonPanel.add(scrollButton); buttonGroup.add(scrollButton); add(buttonPanel, BorderLayout.SOUTH); }
From source file:ScrollDemo2.java
public void init() { JRadioButton form[][] = new JRadioButton[12][5]; String counts[] = { "", "0-1", "2-5", "6-10", "11-100", "101+" }; String categories[] = { "Household", "Office", "Extended Family", "Company (US)", "Company (World)", "Team", "Will", "Birthday Card List", "High School", "Country", "Continent", "Planet" }; JPanel p = new JPanel(); p.setSize(600, 400);// w w w .j a va2 s.c om p.setLayout(new GridLayout(13, 6, 10, 0)); for (int row = 0; row < 13; row++) { ButtonGroup bg = new ButtonGroup(); for (int col = 0; col < 6; col++) { if (row == 0) { p.add(new JLabel(counts[col])); } else { if (col == 0) { p.add(new JLabel(categories[row - 1])); } else { form[row - 1][col - 1] = new JRadioButton(); bg.add(form[row - 1][col - 1]); p.add(form[row - 1][col - 1]); } } } } scrollpane = new JScrollPane(p); // Add in some JViewports for the column and row headers JViewport jv1 = new JViewport(); jv1.setView(new JLabel(new ImageIcon("columnlabel.gif"))); scrollpane.setColumnHeader(jv1); JViewport jv2 = new JViewport(); jv2.setView(new JLabel(new ImageIcon("rowlabel.gif"))); scrollpane.setRowHeader(jv2); // And throw in an information button JButton jb1 = new JButton(new ImageIcon("question.gif")); jb1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { JOptionPane.showMessageDialog(null, "This is an Active Corner!", "Information", JOptionPane.INFORMATION_MESSAGE); } }); scrollpane.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, jb1); getContentPane().add(scrollpane, BorderLayout.CENTER); }
From source file:dictionary.GUI.GUI_Main.java
/** * Creates new form GUI// w w w .j a v a 2 s. c o m * * @throws java.io.FileNotFoundException */ public GUI_Main() throws FileNotFoundException, IOException { dic = dicEV; initComponents(); //SetIcon cho frame ImageIcon icon = new ImageIcon("src/dictionary/images/find.png"); Image image = icon.getImage(); this.setIconImage(image); fieldWord.requestFocus(); }
From source file:daylightchart.gui.util.GuiAction.java
/** * Creates a new action.// w w w. j av a 2s. c o m * * @param text * Text of the action * @param iconResource * Icon */ public GuiAction(final String text, final String iconResource) { this(text); if (StringUtils.isNotBlank(iconResource)) { final URL resource = GuiAction.class.getResource(iconResource); if (resource != null) { setIcon(new ImageIcon(resource)); } } }
From source file:net.adamjak.thomas.graph.application.gui.ResultsWidnow.java
public ResultsWidnow(Map<String, Object> results) { super(WINDOW_TITLE); this.resultsWidnow = this; this.results = results; setIconImage(new ImageIcon(getClass().getClassLoader().getResource("logo-image/logo_64.png")).getImage()); setContentPane(rootPanel);/*from ww w . j av a2s . c o m*/ pack(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setSize(800, 500); if (this.results.containsKey("test")) { this.jlTestType.setText(this.results.get("test").toString()); } if (this.results.containsKey("times")) { this.jlNumberOfRuns.setText(this.results.get("times").toString()); } setJMenuBar(this.createJMenuBar()); setVisible(true); }
From source file:ru.codemine.pos.ui.windows.selector.PeriodSelector.java
public PeriodSelector() { setTitle(" "); setSize(400, 200);/* ww w.j a va 2s. c om*/ setLocationRelativeTo(null); dateStartLabel = new WebLabel("? "); dateEndLabel = new WebLabel(" "); dateStartField = new WebDateField(LocalDate.now().toDate()); dateEndField = new WebDateField(LocalDate.now().toDate()); selectButton = new WebButton("", new ImageIcon("images/icons/default/16x16/button-ok.png")); cancelButton = new WebButton("", new ImageIcon("images/icons/default/16x16/button-cancel.png")); selectButton.setMargin(5); cancelButton.setMargin(5); selectButton.setRound(StyleConstants.largeRound); cancelButton.setRound(StyleConstants.largeRound); buttonsGroupPanel = new GroupPanel(10, selectButton, cancelButton); TableLayout layout = new TableLayout(new double[][] { { 10, TableLayout.PREFERRED, 10, TableLayout.FILL, 10 }, { 10, TableLayout.PREFERRED, 10, TableLayout.PREFERRED, 10, TableLayout.FILL, 10, TableLayout.PREFERRED, 10 } }); setLayout(layout); add(dateStartLabel, "1, 1"); add(dateStartField, "3, 1"); add(dateEndLabel, "1, 3"); add(dateEndField, "3, 3"); add(buttonsGroupPanel, "1, 7, 3, 7, C, T"); clientWindow = null; }
From source file:net.sf.keystore_explorer.gui.actions.ExportKeyPairCertificateChainAction.java
/** * Construct action./*from w w w .j a v a 2 s.c o m*/ * * @param kseFrame * KeyStore Explorer frame */ public ExportKeyPairCertificateChainAction(KseFrame kseFrame) { super(kseFrame); putValue(LONG_DESCRIPTION, res.getString("ExportKeyPairCertificateChainAction.statusbar")); putValue(NAME, res.getString("ExportKeyPairCertificateChainAction.text")); putValue(SHORT_DESCRIPTION, res.getString("ExportKeyPairCertificateChainAction.tooltip")); putValue(SMALL_ICON, new ImageIcon(Toolkit.getDefaultToolkit() .createImage(getClass().getResource(res.getString("ExportKeyPairCertificateChainAction.image"))))); }