How to setup JAWS for Java Swing applications
Hello All,
I am having one swing application and need to test with JAWS.Could you please let me know the configuration steps.I tried with the following steps and it is not working properly.
1. Install JDK1.5.0_08
2. Install JAWS 7.0
3. Install SUN accessbridge-2_0_1
4. Copied access-bridge, jaccess-1_4 and accessibility.properties to jre\lib\ext
it is not identifying even buttons also.
Thanks & Regards,
Gana
Hello there,
Gana, Ana
I have the same problem
1. Install JDK1.5.0_08
2. Install JAWS 7.0
3. Install SUN accessbridge-2_0_1
4. Copied access-bridge, jaccess-1_4 and accessibility.properties to jre\lib\ext
and nothing
Similar Messages
-
Accelarate the Linux ATI Graphics card for java Swing application
Hi All,
I am using a ATI Radeon 9550 Graphic card in LFS (Linux from the scratch) environment. I want to enable the OpenGL-based pipeline for Java Swing application. I tried the -Dsun.java2d.opengl=true . But the Java swing application getting very slow.
How to overcome this problem?
Any one give the procedure to Accelerate ATI graphics card for Java Swing Application
How to verify Java swing use ATI graphics card ?
Thanks in advance..
Prabhu.SHi All,
I am using a ATI Radeon 9550 Graphic card in LFS (Linux from the scratch) environment. I want to enable the OpenGL-based pipeline for Java Swing application. I tried the -Dsun.java2d.opengl=true . But the Java swing application getting very slow.
How to overcome this problem?
Any one give the procedure to Accelerate ATI graphics card for Java Swing Application
How to verify Java swing use ATI graphics card ?
Thanks in advance..
Prabhu.S -
Design Patterns for java swing application front a J2EE server
Hi,
i dont nkow that i stay in the correct forum. I am development a java swing client application, no web, and i dont know that if there are any patterns for a client of this type.
I have readed http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html
but after of Buissnes Delegate pattern, the others one, over ejb tier, are applicated only for web clients, using servlets and jsp pages.
If i have a swing client application, what patterns i must folow for implement the client logic of my swing application??
thanksMVC pattern is one of the most used
http://en.wikipedia.org/wiki/MVC
http://csis.pace.edu/~bergin/mvc/mvcgui.html
... -
How to disable html for whole swing application.
Hi,
As we can disable html for individual swing components , for example JLabel
label.putClientProperty("html.disable",Boolean.TRUE);
BasicHTML.updateRenderer(label,"html.disable");
is there any way to disable html rendering in swing components for system wide / whole application?.
Thanks
KiranBetter use a utility method in the application like this
public static void disableHtml(JComponent component)
component.putClientProperty("html.disable",Boolean.TRUE);
BasicHTML.updateRenderer(component,"html.disable");
call disableHtml(Component u want to set html disable) for any component in the application. -
How to setup Proxy for Java Web Start App ?
I'm having trouble getting Java Web Start to work.
at... http://java.sun.com/docs/books/tutorial/uiswing/14start/compile.html
It tell me...
To test whether your browser can launch an application using Java Web Start, click this link.
http://java.sun.com/docs/books/tutorialJWS/uiswing/14start/example-1dot4/HelloJWS.jnlp
I do that & see Java Web Start try to start but get message...
Java Web Start - Invalid Argument
Unable to launch specified application
An error occurred while launching/running the application.
Category: Invalid Argument error
Could not load file/URL specified: C:\Documents and Settings\Will\Local Settings\Temporary Internet Files\Content.IE5\OP8RSBCV\HelloJWS[1].jnlp
Then... http://java.sun.com/docs/books/tutorial/information/javawebstart.html tells me...
"This situation usually happens when your browser and your copy of Java Web Start have different proxy settings."
I click Start | Programs | Java Web Start | Java Web Start,,, then click File | Preferences | General
My choices are... Proxies: None User Browser _ Manual (User Browser grayed out)
If _ Manual checked then I get...
HTTP Proxy ______
HTTP Port _______
I'm running XP Pro via Wi Fi to a Linksys Wi Fi router to a cable modem... I'm also running Zone Alarm (tried turning it off but no luck)
I don't know how to set up the Proxy stuff... can any one please help me get this set up.
thanks - WillOK, on my XP Pro system I went to...
Start IE -> Control Panel -> Internet Options -> Connections -> Lan Settings -> Proxy Settings
This is my 'Local Area network (LAN) Settings panel...
- user Proxy server for LAN is checked
- Address is blank
- Port is blank
So do I plug something in here... the ip address of my linksys wi-fi router and a port number or what?
My Java Web Start Preferences won't let me click 'Use Browser' only None or Manual
If I click Manual, I don't know what to plug into the HTTP Proxy and HTTP Port fields...
I tried the ip address of my router... thinking it may have a built in Proxy Server... and port 8080 as indicated by the Help page for the Java Web Start... but no luck.
I really appriceate any help on this...
thanks - Will -
How many softwares are there to create a setup file for java programs
Hi, i am new to java
I want to know how many softwares are there to create a setup file for java programs.
I know one software i.e java launcher to create a setup file.
I want to know about any other softwares are available to create a setup file for java programs.
I created a setup file for swings program in JCreator.
And don't think that i am wastiing ur time with this question .
Help me regarding this topic.
Thanks in Advancesuperstar wrote:
I want to know how many softwares are there to create a setup file for java programs.13, no wait, 42.
I know one software i.e java launcher to create a setup file.You should clearly identify what you think you already know.
I want to know about any other softwares are available to create a setup file for java programs.
I created a setup file for swings program in JCreator.Is this the one you talked before, or is this different?
And don't think that i am wasting ur time with this question .Why should I not think that? -
How to create the digital clock in java swing application ?
I want to create the running digital clock in my java swing application. Can someone throw some light on this how to do this ? Or If someone has done it then can someone pl. paste the code ?
Thanks.hi prah_Rich,
I have created a digital clock you can use. You will most likely have to change some things to use it in another app although that shouldn't be too hard. A least it can give you some ideas on how to create one of your own. There are three classes.One that creates the numbers. a gui class and frame class.
cheers:)
Hex45
import java.awt.*;
import java.util.*;
import javax.swing.*;
import java.awt.geom.*;
public class DigitalClock extends Panel{
BasicStroke stroke = new BasicStroke(4,BasicStroke.CAP_ROUND,
BasicStroke.JOIN_BEVEL);
String hour1, hour2;
String minute1, minute2;
String second1, second2;
String mill1, mill2, mill3;
int hr1, hr2;
int min1, min2;
int sec1, sec2;
int mll1, mll2,mll3;
public void update(Graphics g){
paint(g);
public void paint(Graphics g){
Graphics2D g2D = (Graphics2D)g;
DigitalNumber num = new DigitalNumber(10,10,20,Color.cyan,Color.black);
GregorianCalendar c = new GregorianCalendar();
String hour = String.valueOf(c.get(Calendar.HOUR));
String minute = String.valueOf(c.get(Calendar.MINUTE));
String second = String.valueOf(c.get(Calendar.SECOND));
String milliSecond = String.valueOf(c.get(Calendar.MILLISECOND));
if(hour.length()==2){
hour1 = hour.substring(0,1);
hour2 = hour.substring(1,2);
}else{
hour1 = "0";
hour2 = hour.substring(0,1);
if(minute.length()==2){
minute1 = minute.substring(0,1);
minute2 = minute.substring(1,2);
}else{
minute1 = "0";
minute2 = minute.substring(0,1);
if(second.length()==2){
second1 = second.substring(0,1);
second2 = second.substring(1,2);
}else{
second1 = "0";
second2 = second.substring(0,1);
if(milliSecond.length()==3){
mill1 = milliSecond.substring(0,1);
mill2 = milliSecond.substring(1,2);
mill3 = milliSecond.substring(2,3);
}else if(milliSecond.length()==2){
mill1 = "0";
mill2 = milliSecond.substring(0,1);
mill3 = milliSecond.substring(1,2);
}else{
mill1 = "0";
mill2 = "0";
mill3 = milliSecond.substring(0,1);
hr1 = Integer.parseInt(hour1);
hr2 = Integer.parseInt(hour2);
min1 = Integer.parseInt(minute1);
min2 = Integer.parseInt(minute2);
sec1 = Integer.parseInt(second1);
sec2 = Integer.parseInt(second2);
mll1 = Integer.parseInt(mill1);
mll2 = Integer.parseInt(mill2);
g2D.setStroke(stroke);
g2D.setPaint(Color.cyan);
num.setSpacing(true,8);
num.setSpacing(true,8);
if(hr1==0&hr2==0){
num.drawNumber(1,g2D);
num.setLocation(40,10);
num.drawNumber(2,g2D);
else{
if(!(hr1 == 0)){
num.drawNumber(hr1,g2D);
num.setLocation(40,10);
num.drawNumber(hr2,g2D);
num.setLocation(70,10);
num.drawNumber(DigitalNumber.DOTS,g2D);
num.setLocation(100,10);
num.drawNumber(min1,g2D);
num.setLocation(130,10);
num.drawNumber(min2,g2D);
num.setLocation(160,10);
num.drawNumber(DigitalNumber.DOTS,g2D);
num.setLocation(190,10);
num.drawNumber(sec1,g2D);
num.setLocation(220,10);
num.drawNumber(sec2,g2D);
/*num.setLocation(250,10);
num.drawNumber(DigitalNumber.DOTS,g2D);
num.setLocation(280,10);
num.drawNumber(mll1,g2D);
num.setLocation(310,10);
num.drawNumber(mll2,g2D);
g2D.setPaint(Color.cyan);
if((c.get(Calendar.AM_PM))==Calendar.AM){
g2D.drawString("AM",260,20);
}else{
g2D.drawString("PM",260,20);
String dayOfweek = "";
switch(c.get(Calendar.DAY_OF_WEEK)){
case(Calendar.SUNDAY):
dayOfweek = "Sunday, ";
break;
case(Calendar.MONDAY):
dayOfweek = "Monday, ";
break;
case(Calendar.TUESDAY):
dayOfweek = "Tuesday, ";
break;
case(Calendar.WEDNESDAY):
dayOfweek = "Wednesday, ";
break;
case(Calendar.THURSDAY):
dayOfweek = "Thursday, ";
break;
case(Calendar.FRIDAY):
dayOfweek = "Friday, ";
break;
case(Calendar.SATURDAY):
dayOfweek = "Saturday, ";
break;
String month = "";
switch(c.get(Calendar.MONTH)){
case(Calendar.JANUARY):
month = "January ";
break;
case(Calendar.FEBRUARY):
month = "February ";
break;
case(Calendar.MARCH):
month = "March ";
break;
case(Calendar.APRIL):
month = "April ";
break;
case(Calendar.MAY):
month = "May ";
break;
case(Calendar.JUNE):
month = "June ";
break;
case(Calendar.JULY):
month = "July ";
break;
case(Calendar.AUGUST):
month = "August ";
break;
case(Calendar.SEPTEMBER):
month = "September ";
break;
case(Calendar.OCTOBER):
month = "October ";
break;
case(Calendar.NOVEMBER):
month = "November ";
break;
case(Calendar.DECEMBER):
month = "December ";
break;
int day = c.get(Calendar.DAY_OF_MONTH);
int year = c.get(Calendar.YEAR);
Font font = new Font("serif",Font.PLAIN,24);
g2D.setFont(font);
g2D.drawString(dayOfweek+month+day+", "+year,10,80);
public static void main(String args[]){
AppFrame aframe = new AppFrame("Digital Clock");
Container cpane = aframe.getContentPane();
final DigitalClock dc = new DigitalClock();
dc.setBackground(Color.black);
cpane.add(dc,BorderLayout.CENTER);
aframe.setSize(310,120);
aframe.setVisible(true);
class Task extends TimerTask {
public void run() {
dc.repaint();
java.util.Timer timer = new java.util.Timer();
timer.schedule(new Task(),0L,250L);
class DigitalNumber {
private float x=0;
private float y=0;
private float size=5;
private int number;
private Shape s;
private float space = 0;
public static final int DOTS = 10;
private Color on,off;
DigitalNumber(){
this(0f,0f,5f,Color.cyan,Color.black);
DigitalNumber(float x,float y, float size,Color on,Color off){
this.x = x;
this.y = y;
this.size = size;
this.on = on;
this.off = off;
public void drawNumber(int number,Graphics2D g){
int flag = 0;
switch(number){
case(0):
flag = 125;
break;
case(1):
flag = 96;
break;
case(2):
flag = 55;
break;
case(3):
flag = 103;
break;
case(4):
flag = 106;
break;
case(5):
flag = 79;
break;
case(6):
flag = 94;
break;
case(7):
flag = 97;
break;
case(8):
flag = 127;
break;
case(9):
flag = 107;
break;
case(DOTS):
GeneralPath path = new GeneralPath();
path.moveTo(x+(size/2),y+(size/2)-1);
path.lineTo(x+(size/2),y+(size/2)+1);
path.moveTo(x+(size/2),y+(size/2)+size-1);
path.lineTo(x+(size/2),y+(size/2)+size+1);
g.setPaint(on);
g.draw(path);
return;
//Top
if((flag & 1) == 1){
g.setPaint(on);
}else{
g.setPaint(off);
GeneralPath Top = new GeneralPath();
Top.moveTo(x + space, y);
Top.lineTo(x + size - space, y);
g.draw(Top);
//Middle
if((flag & 2) == 2){
g.setPaint(on);
}else{
g.setPaint(off);
GeneralPath Middle = new GeneralPath();
Middle.moveTo(x + space, y + size);
Middle.lineTo(x + size - space,y + size);
g.draw(Middle);
//Bottom
if((flag & 4) == 4){
g.setPaint(on);
}else{
g.setPaint(off);
GeneralPath Bottom = new GeneralPath();
Bottom.moveTo(x + space, y + (size * 2));
Bottom.lineTo(x + size - space, y + (size * 2));
g.draw(Bottom);
//TopLeft
if((flag & 8) == 8){
g.setPaint(on);
}else{
g.setPaint(off);
GeneralPath TopLeft = new GeneralPath();
TopLeft.moveTo(x, y + space);
TopLeft.lineTo(x, y + size - space);
g.draw(TopLeft);
//BottomLeft
if((flag & 16) == 16){
g.setPaint(on);
}else{
g.setPaint(off);
GeneralPath BottomLeft = new GeneralPath();
BottomLeft.moveTo(x, y + size + space);
BottomLeft.lineTo(x, y + (size * 2) - space);
g.draw(BottomLeft);
//TopRight
if((flag & 32) == 32){
g.setPaint(on);
}else{
g.setPaint(off);
GeneralPath TopRight = new GeneralPath();
TopRight.moveTo(x + size, y + space);
TopRight.lineTo(x + size, y + size - space);
g.draw(TopRight);
//BottomRight
if((flag & 64) == 64){
g.setPaint(on);
}else{
g.setPaint(off);
GeneralPath BottomRight = new GeneralPath();
BottomRight.moveTo(x + size, y + size + space);
BottomRight.lineTo(x + size, y + (size * 2) - space);
g.draw(BottomRight);
public void setSpacing(boolean spacingOn){
if(spacingOn == false){
space = 0;
else{
this.setSpacing(spacingOn,5f);
public void setSpacing(boolean spacingOn,float gap){
if(gap<2){
gap = 2;
if(spacingOn == true){
space = size/gap;
public void setLocation(float x,float y){
this.x = x;
this.y = y;
public void setSize(float size){
this.size = size;
class AppFrame extends JFrame{
AppFrame(){
this("Demo Frame");
AppFrame(String title){
super(title);
setSize(500,500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} -
How can I unit test my Swing application?
Hi All,
In my application I came across a situation where I have to automate the unit testing of my application.
Using my application user can able to draw polylines and rectangles on a BufferedImage added to a JFrame.
Can any one please help/suggest me, how to automate the drawing process (this process consists of drawing the polylines with mouse and few action/mouse events)?
your help will be highly helpful to me.
SatyaWhat exactly will that unit test prove? That you can mock the drawing of lines?
Unit test are supposed to test certain parts of your application code - I'd concentrate on unit tests that are actually useful and for example in the future can help to catch regressions.
If anywhere you can get help creating unit tests of this magnitude, I'd look in the unit testing support for Swing applications. Google for "java swing unit test" to see what you can come up with. Probably you'll need to create some plumbing yourself to make custom painting unit-testable; perhaps you could do something with painting to a BufferedImage in stead of to a Swing component for example. -
Unicode characters with accents won't display in Java Swing applications
I'm using FreeMind (a Java Swing application) and I need to enter classical Greek characters with accent marks. When I type an accented Greek character, FreeMind displays the unaccented character. However, I can type the accented character in MS Word, then copy and paste into FreeMind, the accented character appears.
One of the FreeMind developers indicated this was a Java Swing issue, not FreeMind, and suggested I test with another Swing application. So, I installed jEdit and got exactly the same results. I can paste an accented character into jEdit, but I cannot type it in directly.
I'm using Windows Vista with Java 6 Update 22 (build 1.6.0_22-b04). I also tested on a XP Pro box with Java 1.6.0_18-b07 and got the same result.
One other note: A couple days ago, I was able to type accented Greek characters into FreeMind. But it only worked for a couple days and then the behavior reverted to unaccented characters. It is possible, but I don't recall specifically, that I updated Java during the time and that may indicate a bug in one version of Java but not another.
Any assistance or guidance would be greatly appreciated!
DarinWalter,
The link you provided does not appear to describe the Greek Polytonic keyboard. (The page also describes using the "Option" key as the dead key. There is no "Option" key on my keyboard. I'm using a Sony VGN-NS140E purchased in Chicago, i.e. standard physical US keyboard.)
Please see http://darindavis.net/languages/keyboard_Greek.pdf for a detailed description of how to use the Greek (Polytonic) keyboard in Windows to produce a complete set of accented classical Greek characters. This method works in MS Word and Notepad. I enabled the Greek (Polytonic) keyboard with:
Windows (Vista) Start > Control Panel > Regional and Language Options > Change Keyboards > General > Add > Greek (Greece) > Greek Polytonic
A test that will demonstrate whether you can replicate the error is to do the following in both MS Word (or Notepad) and jEdit (or FreeMind):
1. Enable the Greek Polytonic keyboard
2. Type "\" then "e" which should produce an epsilon with smooth breathing and grave accent (ἒ)
When I do this in MS Word or Notepad, I see the epsilon with smooth breathing and grave accent. When I do this in jEdit and FreeMind, I only see an epsilon.
I recorded a screencast to illustrate the problem: http://www.screencast.com/t/TRKkKQrCgbN
Actually, this problem is transient. Sometimes FreeMind or jEdit will display accented characters, other times it won't. Ironically, the first time I recorded the above referenced screencast, a few characters in jEdit did appear with accents. A couple minutes later, I re-recorded the screencast and as you can see jEdit did not display the accents. Between the two recordings I literally did nothing other than stop the Jing recording and start a new one. There is another variable at play here and I can't determine what it is. The most likely source seems to be Java since MS Word and Notepad consistently display accent characters.
Thanks,
Darin -
BackGround picture for a Swing application??
hi,
once I got a nice idea while watching some webpages. we can give a background picture for a webpage in <body> tag?
I want to do same thing for any Swing application. Currently I am working on that issue. Any suggestions are welcome!!
santhoshHi everybody!
Finally I got it. now Using this We can enable background for any swing application.
the complete code is shown here. If you have any problems regarding this code, please mail to [email protected]
/******************************[TexturedImageIcon.java]***********************/
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
/* this is used to generate a tiled image from a given image file.*/
public class TexturedImageIcon extends ImageIcon
private Dimension size = new Dimension(10, 10);
BufferedImage bimg1,bimg;
Graphics2D g2;
ComponentListener cl = new ComponentAdapter(){
public void componentResized(ComponentEvent ce){
Component c = (Component)ce.getSource();
size = c.getSize();
createImage();
public void setImage(String filename){
super.setImage(new ImageIcon(filename).getImage());
bimg1=null;
createImage();
public TexturedImageIcon(Component comp, Image img){
super(img);
addListener(comp);
public TexturedImageIcon(Component comp, String filename){
super(filename);
addListener(comp);
public TexturedImageIcon(Component comp, URL url){
super(url);
addListener(comp);
private void addListener(Component comp){
comp.addComponentListener(cl);
private void createImage(){
bimg = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
g2 = bimg.createGraphics();
Rectangle2D rect = new Rectangle2D.Float(0,0,size.width-1, size.height-1);
Rectangle2D tr = new Rectangle2D.Double(0,0,super.getIconWidth(), super.getIconHeight());
if(bimg1==null){
bimg1 = new BufferedImage(super.getIconWidth(), super.getIconHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g = bimg1.createGraphics();
g.drawImage(super.getImage(), null, null);
TexturePaint tp = new TexturePaint(bimg1, tr);
g2.setPaint(tp);
g2.fill(rect);
public int getIconWidth(){ return size.width; }
public int getIconHeight(){ return size.height; }
public Image getImage(){
System.out.println("asked");
return bimg;
public void paintIcon(Component c, Graphics g, int x, int y){
Graphics2D g2d =(Graphics2D)g;
g2d.drawImage(bimg, null, null);
public static void main(String[] args){
JFrame f = new JFrame();
f.setSize(300,300);
JLabel label = new JLabel();
label.setBackground(Color.white);
label.setBorder(BorderFactory.createRaisedBevelBorder());
label.setIcon(new TexturedImageIcon(label, "world2.gif"));
f.getContentPane().setLayout(new BorderLayout());
f.getContentPane().add(label, BorderLayout.CENTER);
f.show();
/*********************************[JFCUtils.java]************************/
/*The main logic to enable background picture lies in this class*/
public class JFCUtils{
public static ContainerListener cl = new ContainerAdapter(){
public void componentAdded(ContainerEvent ce){
JComponent child = (JComponent)ce.getChild();
child.setOpaque(false);
child.addContainerListener(this);
addlisteners(child);
public static TexturedImageIcon enableBackGround(JFrame f, String filename){
((JPanel)f.getContentPane()).setOpaque(false);
JLayeredPane lp = f.getLayeredPane();
JLabel label = new JLabel();
TexturedImageIcon icon = new TexturedImageIcon(label, filename);
label.setIcon(icon);
JPanel panel = new JPanel(new BorderLayout());
panel.add(label, BorderLayout.CENTER);
lp.add(panel, new Integer(Integer.MIN_VALUE));
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
panel.setBounds(0, 0, screen.width,screen.height);
addlisteners((JComponent)f.getContentPane());
return icon;
private static void addlisteners(Component c){
c.toString();
if(c instanceof JComponent) ((JComponent)c).setOpaque(false);
if(c instanceof Container){
Container ct = (Container)c;
ct.addContainerListener(cl);
for(int i=0; i<ct.getComponentCount(); i++){ //recursivly make all subcomponents transparent
Component child = (Component)ct.getComponent(i);
addlisteners(child);
public static void main(String[] args){
JFrame f = new JFrame();
enableBackGround(f, "bg.jpg");
JButton b = new JButton("fdfdfdfd");
f.getContentPane().add(b, BorderLayout.NORTH);
f.setSize(300,300);
f.show();
/*************************************[UserDialog.java]**************************/
//to check how a swing application with background looks like
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class UserDialog extends JDialog
JPanel contents = (JPanel)getContentPane();
JTextField shortField = new JTextField(20);
JTextField nameField = new JTextField(20);
JTextField emailField = new JTextField(20);
JTextField smtpServerField = new JTextField(20);
JTextField pwdField = new JPasswordField(20);
JTextField pwdField1 = new JPasswordField(20);
boolean okay = false;
public UserDialog(JFrame owner){
super(owner, "New User Details", true);
initComponents();
pack();
setResizable(false);
public UserDialog(JDialog owner){
super(owner, "New User Details", true);
initComponents();
pack();
setResizable(false);
private void initComponents(){
JPanel west = new JPanel(new GridLayout(0, 1));
west.add(new JLabel("Short Name"));
west.add(new JLabel("Full Name"));
west.add(new JLabel("Email"));
west.add(new JLabel("SMTP Server"));
west.add(new JLabel("Password"));
west.add(new JLabel("Confirm Password"));
JPanel east = new JPanel(new GridLayout(0, 1));
east.add(shortField);
east.add(nameField);
east.add(emailField);
east.add(smtpServerField);
east.add(pwdField);
east.add(pwdField1);
JPanel south = new JPanel();
JButton ok = new JButton("Ok");
JButton cancel = new JButton("Cancel");
south.add(ok);
south.add(cancel);
contents.setBorder(JFCUtils.border);
contents.setLayout(new BorderLayout(10, 10));
contents.add(west, BorderLayout.WEST);
contents.add(east, BorderLayout.EAST);
contents.add(south, BorderLayout.SOUTH);
ActionListener al = new ActionListener(){
public void actionPerformed(ActionEvent ae){
okay = ae.getActionCommand().equals("Ok");
setVisible(false);
ok.addActionListener(al);
cancel.addActionListener(al);
private void clearFields(){
shortField.setText("");
nameField.setText("");
emailField.setText("");
smtpServerField.setText("");
pwdField.setText("");
pwdField1.setText("");
public User getUser(){
clearFields();
okay = false;
show();
if(okay) return new User(shortField.getText(), nameField.getText(), emailField.getText(), smtpServerField.getText(), pwdField.getText());
else return null;
public static void main(String[] args){
Dialog dlg = new UserDialog();
TexturedImageIcon ticon = JFCUtils.enableBackGround(f, "bg.jpg");.show();
//we can change the background picture by calling ticon.setImage(...) at runtime. -
Book Recommendation for Building Swing Applications
I'm looking for recommendations on books for building swing applications from the ground up.
I'm not a strong GUI developer. 95% of my experience has been strictly on back end development in many other languages. What little GUI experience I have has been with C++ (years ago) and most recently with HTML.
I know what I want to develop, and even have the GUI design for my application drawn out. I just need a good book that can walk me through developing the interface in Java.
I already have several books on Java. But, I find them somewhat limiting because they don't help me build the app from the ground up.
Yes, I've tried the online book on the Sun site, "The Jfc Swing Tutorial: Guide to Constructing Gui's".
Please offer some recommendations and reasons on why you like the book.
Thanks.A few comments to that ....
the first thing is understanding the LayoutManagers, that are available.
I will give you a short guideline where they are usefull:
FlowLayout - usefull for JLabel-JTextField combinations or several JButtons
BorderLayout - usefull for the structure of basic containers
CardLayout - usefull for every area of the screen, where you want to appear different panels
GridLayout - usefull for a group of same-sized components laid out in a grid
GridBagLayout - usefull for a group of components, that have different sizes, very flexible
JTabbedPane - a special container, that is similar to CardLayout but with visible tabs to switch panels
Normally you can say "I want that group at the bottom of the frame, that other group at its left side, that toolbar at its top" - if you can say so - that shouts for BorderLayout. If you can say "in this area I want to use several panels" that means CardLayout or a JTabbedPane.
You see, if you have an idea, what the LayoutManagers do, you know exactly which area needs what Layout - so you have a guideline, which LayoutManager to use in that panel.
To make an example:
You want 3 buttons centered at the bottom of a frame - this 3 buttoms should be of that size, that is needed by the button texts. So, what to do:
1. create a JPanel with FlowLayout
2. create the buttons and add it to that JPanel
3. create another JPanel with BorderLayout
4. add that first JPanel to the second JPanel at BorderLayout.CENTER
5. add this Panel to the ContentPane of the frame at BorderLayout.SOUTH
that is a simple panel in panel construct - placing 3 buttons centered at the bottom of the frame. You have to play with that different LayoutManagers a little bit - the way you stick one panel in another changes the look of the GUI - if you know, how it changes (by playing with the examples of the tutorial), you will have that "from the ground"-experience, you are looking for - believe me.
greetings Marsian -
Certificate support in Java Swing application
Hi There,
I am new to this Certificate thing and running into issues! Would appreciate for all the help and please ignore for any stupid questions.
Here is my scenario.
1. I do have a client server application and client is a java swing application which connects to a Server application (Using Jetty 4.2.22 as embedded server)
2. Initially, it had a self signed certificate but goal is to support third party certificate (i.e import in the server and then show warning to the client during login)
If somebody has already done this or point me to some example (using Jetty APIs) that would be great help. If not, here is what I am trying to do and some questions.
1. I tried to get some free SSL certificate from the web and imported into the server's KeyStore.
If I do a list from the server using Keystore, this is what it looks like
keytool -list -keystore /tmp/keystore -storepass genview
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 2 entries
self, Dec 3, 2008, PrivateKeyEntry,
Certificate fingerprint (MD5): 0D:58:E8:77:89:09:F8:2B:37:64:37:D5:03:AD:C9:0B
rapid, Jan 6, 2009, trustedCertEntry,
Certificate fingerprint (MD5): 64:9C:EF:2E:44:FC:C6:8F:52:07:D0:51:73:8F:CB:3
QUESTION 1 : why the third party certificate's entry as "trustedCertEntry"? Is it always like this? Do I need to have only one certificate at a time? (If so, just remove the self signed and have 3rd party one)
My Jetty server comes up but when I connect from Client Swing App, the "getServerCertificates()" method only returns one entry i.e self signed one but not the third party one.
I am using like this
URL url = new URL("https://127.0.0.1:port");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.connect();
Certificate[] certs = conn.getServerCertificates();
Is not this API supposed to return all the server's certificate?
Please guide me or instruct me what to do.
Thanks,
CRBCrossposted and answered.
-
Invoking a Java swing application via its process id
I have a Java swing application. What i am trying to do here is that when the user double-clicks the jar file to open it, if the Swing application is already open and is minimized, I need to maximize the open window and make it active.
I tried using 'jps -l' command in my new instance, and with the help of Runtime.exec() am able to detect whether the application is already running or not, and if running, am able to get the process id and am displaying a message to user indicating the window is already open.
But how do i maximize the window of an already running application? Is it possible?user13333704 wrote:
I have a Java swing application. What i am trying to do here is that when the user double-clicks the jar file to open it, if the Swing application is already open and is minimized, I need to maximize the open window and make it active. That's not hard to do, but your proposed solution is hard to do. The usual way to have only one instance of a Java application running is this:
Have the application open a SocketServer on a certain port number. Since only one process can listen on a port, the second instance of the application will fail when it tries to open the SocketServer. When that happens, the second instance should terminate instead of displaying its own GUI. Whether it terminates silently or whether it displays a dialog is up to you.
If you want the second instance to communicate with the first instance, that's easy because the first instance is listening on the port. So the second instance could connect to that port and send a message to it. In your case the first instance would respond to that message by maximizing its GUI. -
Viewing and printing a PDF file from Java Swing Application
Hello,
I need to view and print PDF files from Java Swing Application.How do I do that?I appreciate your help.
Thank you
Sumana SomareddyIf you have a link to the URL pointing to the PDF file, you can allow the browser to open it. Then use the print function of the browser to print the PDF document.
Regards,
Tak. -
How to embed/perform a Java Swing form into webased Swing form
How to embed/perform a Java Swing form into webased Swing form or any alternative.
Suppose i have 2 or more swing forms which are desktop applications but i want those forms to be now webbased..so how can i do this.Will i need to change the swing coding or will have to keep the swing design same.what can be the best Solution.You can launch your existing desktop app via the web using [Java Web Start|http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp]
Maybe you are looking for
-
Strange things happen when printing
when I print I have what seems to be some random faded 'boxes' appear in the background. They seem to be related to elements which have a drop shadow or transparency applied to them. I have changed 'All Spots to Process' in the ink manager as that fi
-
Itunes 10.1 iphone problems
i got the iphone 3gs and im having problems. i downloaded the new itunes update and now im trying to put music on my iphone and when i plug it in the only thing that pops up is the camera. so i dont know if its just mine or anyone elses and if anyone
-
Authentication falure 5440, ISE
Hi, Trying to authenticate Windows Vista computers with machine certificate and EAP-TLS on the wired network. Sometimes one or two computers fail the authentication when it boot and it is not allways the same computers. On the wireless network everyt
-
Hi All, I would be very grateful if you would draw some light for this error I got from running a online database connected image viewer (applet). The application is quite simple, applet connect to servlet, servlet send 3 SQL statements to MySQL and
-
Illustrator CC 2014 & Catia V5 DXF/DWG problem
Hello, I have a problem. I need to export somehow from Illustrator some drawings and open it in Catia V5. It shouldn't be a problem, but I lose sometimes 1/10 millimeters, and have to work with a very small tolerance. And as you can see some curves