jlabel

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) {

Rollover on JLabel which consists of image within grid layout?

心不动则不痛 提交于 2020-01-14 08:07:08
问题 I have a code with grid layout and two JLabel images. I wan't some text to appear everytime I roll over each image. I am familiar on how to do this when the image is not a JLabel, but have searched all over the web to find how to do this while it is an unnamed JLabel. The two images I wan't to have, with separate roll over messages are: ImageIcon(getClass().getResource("giraffe.png")); Icon windows = new ImageIcon(getClass().getResource("windows.png")); Here is my code: public class giraffe

HTML does not display my Java Applet with a JLabel

半世苍凉 提交于 2020-01-11 12:03:16
问题 When I execute the HTML file associated with my applet, nothing is drawn and the screen is empty. Why does this happen? How do I add a String into the Applet? Source code for the Java Applet: package m2mcom.web; import m2mcom.entities.AutomatedTelnetClient; import javax.swing.JApplet; import javax.swing.SwingUtilities; import javax.swing.JLabel; public class Displaytext extends JApplet { //Called when this applet is loaded into the browser. public void init() { //Execute a job on the event

HTML does not display my Java Applet with a JLabel

送分小仙女□ 提交于 2020-01-11 12:03:03
问题 When I execute the HTML file associated with my applet, nothing is drawn and the screen is empty. Why does this happen? How do I add a String into the Applet? Source code for the Java Applet: package m2mcom.web; import m2mcom.entities.AutomatedTelnetClient; import javax.swing.JApplet; import javax.swing.SwingUtilities; import javax.swing.JLabel; public class Displaytext extends JApplet { //Called when this applet is loaded into the browser. public void init() { //Execute a job on the event

Updating an image contained in a JLabel - problems

大憨熊 提交于 2020-01-08 18:05:09
问题 The part of the application that I am currently having trouble getting to work is being able to scroll through and display a list of images, one at a time. I'm getting a directory from the user, spooling through all of the files in that directory, and then loading an array of just the jpegs and pngs. Next, I want to update a JLabel with the first image, and provide previous and next buttons to scroll through and display each image in turn. When I try to display the second image, it doesn't

Updating an image contained in a JLabel - problems

情到浓时终转凉″ 提交于 2020-01-08 18:03:49
问题 The part of the application that I am currently having trouble getting to work is being able to scroll through and display a list of images, one at a time. I'm getting a directory from the user, spooling through all of the files in that directory, and then loading an array of just the jpegs and pngs. Next, I want to update a JLabel with the first image, and provide previous and next buttons to scroll through and display each image in turn. When I try to display the second image, it doesn't

Simplest Code to round corners of JLabel in java [duplicate]

☆樱花仙子☆ 提交于 2020-01-07 08:27:26
问题 This question already has answers here : Border with rounded corners & transparency (3 answers) Closed 5 years ago . I have many JLabel 's and want smooth around corners on them. How can I make this? I already searched on SO but I didn't find any answer. Could someone help me with a simple and exact code for making round corners for JLabel 's? Other questions are asking some extra details like border and others but I want just exact and simplest code for making round corners for JLabel 's.

UTF-8 encoding in JLabel on Windows

蓝咒 提交于 2020-01-06 08:14:15
问题 I have a problem with encoding in JLabel on Windows(on *nix OSes everything is okay). Here's an image: http://i.imgur.com/DEkj3.png (the problematic character is the L with ` on the top, it should be ł) and here the code: public void run() { URL url; HttpURLConnection conn; BufferedReader rd; String line; String result = ""; try { url = new URL(URL); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); rd = new BufferedReader(new InputStreamReader(conn.getInputStream

UTF-8 encoding in JLabel on Windows

ぃ、小莉子 提交于 2020-01-06 08:14:00
问题 I have a problem with encoding in JLabel on Windows(on *nix OSes everything is okay). Here's an image: http://i.imgur.com/DEkj3.png (the problematic character is the L with ` on the top, it should be ł) and here the code: public void run() { URL url; HttpURLConnection conn; BufferedReader rd; String line; String result = ""; try { url = new URL(URL); conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); rd = new BufferedReader(new InputStreamReader(conn.getInputStream

Auto create JLabels should be under themselves

允我心安 提交于 2020-01-05 04:54:08
问题 I have a code that automatically create jlabels . I want that each label should be at a row, Not beside! I use this code: lbl = new JLabel[rows]; for (int i = 0; i < rows; i++) { lbl[i] = new JLabel(arrayResultRow[i].toString()+ "\n" ); } But \n does not work! 回答1: Google and study the Java Swing layout manager tutorial and start reading. Likely you're adding the JLabels to a JPanel which uses FlowLayout by default, and you need to change the layout of the container to GridLayout or BoxLayout