imageicon

Inserting Images into a JTextPane Error

故事扮演 提交于 2020-01-24 20:45:11
问题 I asked about this before, but, I decided to start a new thread with a SCCE, it compiles sucessfully but it doesn't insert the image. Can anyone troubleshoot as to why it does this? Thanks, Chris. Here is the full code: package mathnotesplus; import java.awt.Dimension; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.SwingUtilities; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.tree

StretchIcon class doesn't work when returned from a method. Causes error

断了今生、忘了曾经 提交于 2020-01-16 10:31:52
问题 A direct call - new StretchIcon(imageStr); - works. But not when returned from a method. Causes error. public static ImageIcon getPhotoSI(String imageStr){ return new StretchIcon(imageStr); } What could be the problem? StretchIcon Link Error Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous ctor sym type: library.StretchIcon.<init> at library.IImage.getPhotoSI(IImage.java:36) at Users.populateTable(Users.java:448) at FrmUsers.btnSearch

StretchIcon class doesn't work when returned from a method. Causes error

不打扰是莪最后的温柔 提交于 2020-01-16 10:31:36
问题 A direct call - new StretchIcon(imageStr); - works. But not when returned from a method. Causes error. public static ImageIcon getPhotoSI(String imageStr){ return new StretchIcon(imageStr); } What could be the problem? StretchIcon Link Error Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous ctor sym type: library.StretchIcon.<init> at library.IImage.getPhotoSI(IImage.java:36) at Users.populateTable(Users.java:448) at FrmUsers.btnSearch

How to Shuffle image in sequence?

无人久伴 提交于 2020-01-16 03:28:29
问题 I am trying to make Java desktop application where i want to make auto image shuffle i am able to do this but problem is that it is not shuffling all image which i gave i want to shuffle all image how can i achieve this Here is some code I found here: /** * @see https://stackoverflow.com/a/22423511/230513 * @see https://stackoverflow.com/a/12228640/230513 */ public class ImageShuffle extends JPanel { private List<Icon> list = new ArrayList<Icon>(); private JLabel label = new JLabel(); private

How to Shuffle image in sequence?

霸气de小男生 提交于 2020-01-16 03:28:09
问题 I am trying to make Java desktop application where i want to make auto image shuffle i am able to do this but problem is that it is not shuffling all image which i gave i want to shuffle all image how can i achieve this Here is some code I found here: /** * @see https://stackoverflow.com/a/22423511/230513 * @see https://stackoverflow.com/a/12228640/230513 */ public class ImageShuffle extends JPanel { private List<Icon> list = new ArrayList<Icon>(); private JLabel label = new JLabel(); private

Displaying an ImageIcon in a JList that uses a different Object to load the JList data

夙愿已清 提交于 2020-01-15 12:16:06
问题 I have a JList that is being populated through an ArrayList of strings somewhere else, i want to for the same list now display an ImageIcon saved in my directory somewhere. For now i want to display the same icon for any item added to the list (or any items currently in the list). My list should look like this : ICON STUDENT NAME ... ICON STUDENT NAME The problem (The image icon shows the correct height and it is being captured but does not show in the list at run-time Here is my action

Why isn't setIcon displaying image on JButton?

落花浮王杯 提交于 2020-01-15 06:42:48
问题 I swear I've looked everywhere and have been googling for hours. I have added actionListeners to all buttons, and when one is clicked, I want to give it an image with setIcon( image ) like so: public void actionPerformed(ActionEvent e) { if(e.getSource() == button) { ImageIcon icon = new ImageIcon(getClass().getResource("/Images/" +letter+ ".PNG")); button.setIcon(icon ); } 1) I know it's retrieving the image because button.getIcon() gives me something like file:/Users/path/to/Images/X.PNG .

ImageIcon in java

▼魔方 西西 提交于 2020-01-14 13:31:30
问题 i am working on matching photos game, i think i may be able to reset imageIcon by know the name of conteiner lable then reset the label icon when ismatch return false in the isMatch method. the write the following code in each label, the reset work only in the second label .. what should i do ? public ImageIcon firstChoice; public ImageIcon SecoundChoice; public boolean isSelected = false; public boolean isMatch = true; public boolean ismatch(ImageIcon firstChoice, ImageIcon secoundChoce) {

Where have I to put an image to use it to create a new Swing ImageIcon object?

我怕爱的太早我们不能终老 提交于 2020-01-11 12:05:14
问题 I am studying Java Swing library and I have a problem. In an example program it create an ImageIcon object by this line: ImageIcon icon = new ImageIcon(getClass().getResource("exit.png")); Whe I execute my program I obtain the following error caused by the fact that in the project the exit.png is missing: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:205) at com.andrea.second.SimpleMenu.initUI(SimpleMenu.java:23) at com

Packaging a program containing images

一曲冷凌霜 提交于 2020-01-11 10:26:26
问题 I'm having massive issues packaging my java program which contains images into a jar for conversion into and executable file. The images have been used in the background of the program and buttons. Please see the diagram below which shows the program I desire to convert to a jar. IMAGE As you see above the program runs OK. I created the same program with no custom background and custom buttons containing no images and I successfully packaged it into a jar and subsequently into an .exe file.