Can you make java program into GUI?


I am still in the very beginnings oflearning java- and a friend asked me to write her a numerology program- when she types in a name, a number is returned - displaying the name's numerology. It ignores all keys except for characters. And each character stands for a number (A = 1, B = 2 , C = c...) and so on, until 9 is reached, then starts all over again with 1.

So for example, the name LEE would be (L = 3, E = 5, E = 5)
so:
3 + 5 + 5 = 13
13 = 1 + 3 = 4

Thus, the name Lee has numerology number of 4 !

Anyway, the person I am making this for know virtually nothing about computers so I was wondering, is there any possible way to make this program into a graphical interface so she doesn't have to go through dos, find the directory and type in the commands at the dos prompt

If not, do you know of any possible ways to make this more simple for her

Also, is there any code in java to clear the screen

Thank you so much. btw- here is my code, let me know if you see anything standing out that is terribly wrong with it- I knowit may not be very efficient and probably a zillion ways better to code it, but I know it runs

//Numerology // import java.io.*; import java.util.StringTokenizer; public class Numerology { //interactively reads in a list of integers, one per line (max of 10) //and prints out the list in reverse order public static void main(String[]args)throws IOException {InputStreamReader reader = new InputStreamReader(System.in); BufferedReader keyInput = new BufferedReader(reader); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println("Type in a name." + "\n Press enter to stop."); System.out.println(); System.out.println(); String newName = keyInput.readLine(); while (!newName.equals("")) { String theName= newName; int holdNum; holdNum = findNumber(newName); String stringNum = String.valueOf(holdNum); int finalNumber = minNumber(stringNum); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println("***************************************"); System.out.println(""); System.out.println(""); System.out.println(""); System.out.println(" " + newName +" = " + finalNumber); System.out.println(""); System.out.println(); System.out.println(); System.out.println("***************************************"); System.out.println(); System.out.println(); System.out.println("Type in a new name to continue, or hit enter to stop."); System.out.println(); System.out.println(); System.out.println(); newName = keyInput.readLine(); } } public static int findNumber(String newName) { int a = 1; int b = 2; int c = 3; int d = 4; int e = 5; int f = 6; int g = 7; int h = 8; int i = 9; int j = 1; int k = 2; int l = 3; int m = 4; int n = 5; int o = 6; int p = 7; int q = 8; int r = 9; int s = 1; int t = 2; int u = 3; int v = 4; int w = 5; int x = 6; int y = 7; int z = 8; int holdNum = 0; char theLetter; int nameLength = newName.length(); int in = 0; while (in < nameLength) { theLetter = newName.charAt(in); if (newName.charAt(in) == 'a'|| theLetter == 'A') { holdNum = holdNum + a; System.out.print(a + "+"); } else if (theLetter == 'b' || theLetter == 'B') { holdNum = holdNum + b; System.out.print(b + "+"); } else if (newName.charAt(in) == 'c'|| theLetter == 'C') { holdNum = holdNum + c; System.out.print(c + "+"); } else if (newName.charAt(in) == 'd'|| theLetter == 'D') holdNum = holdNum + d; else if (newName.charAt(in) == 'e'|| theLetter == 'E') holdNum = holdNum + e; else if (newName.charAt(in) == 'f'|| theLetter == 'F') holdNum = holdNum + f; else if (newName.charAt(in) == 'g'|| theLetter == 'G') holdNum = holdNum + g; else if (newName.charAt(in) == 'h'|| theLetter == 'H') holdNum = holdNum + h; else if (newName.charAt(in) == 'i'|| theLetter == 'I') holdNum = holdNum + i; else if (newName.charAt(in) == 'j'|| theLetter == 'J') holdNum = holdNum + j; else if (newName.charAt(in) == 'k'|| theLetter == 'K') holdNum = holdNum + k; else if (newName.charAt(in) == 'l'|| theLetter == 'L') holdNum = holdNum + l; else if (newName.charAt(in) == 'm'|| theLetter == 'M') holdNum = holdNum + m; else if (newName.charAt(in) == 'n'|| theLetter == 'N') holdNum = holdNum + n; else if (newName.charAt(in) == 'o'|| theLetter == 'O') holdNum = holdNum + o; else if (newName.charAt(in) == 'p'|| theLetter == 'P') holdNum = holdNum + p; else if (newName.charAt(in) == 'q'|| theLetter == 'Q') holdNum = holdNum + q; else if (newName.charAt(in) == 'r'|| theLetter == 'R') holdNum = holdNum + r; else if (newName.charAt(in) == 's'|| theLetter == 'S') holdNum = holdNum + s; else if (newName.charAt(in) == 't'|| theLetter == 'T') holdNum = holdNum + t; else if (newName.charAt(in) == 'u'|| theLetter == 'U') holdNum = holdNum + u; else if (newName.charAt(in) == 'v'|| theLetter == 'V') holdNum = holdNum + v; else if (newName.charAt(in) == 'w'|| theLetter == 'W') holdNum = holdNum + w; else if (newName.charAt(in) == 'x'|| theLetter == 'X') holdNum = holdNum + x; else if (newName.charAt(in) == 'y'|| theLetter == 'Y') holdNum = holdNum + y; else if (newName.charAt(in) == 'z'|| theLetter == 'Z') holdNum = holdNum + z; in++; } return holdNum; } public static int minNumber(String numberToMin) { int theNum = Integer.parseInt(numberToMin); if (theNum < 10) { return theNum; } else if (theNum == 11 || theNum == 22 || theNum == 33) { return theNum; } else { while (theNum > 9) { int theTotal = 0; int ji = 0; String tempSt = String.valueOf(theNum); while (ji < tempSt.length()) { int hold = Integer.parseInt(tempSt.charAt(ji) + ""); theTotal = theTotal + hold; ji++; } theNum = theTotal; } } return theNum; } }
Posted On: Tuesday 23rd of October 2012 11:30:08 PM Total Views:  238
View Complete with Replies

RELATED TOPICS OF Swing / AWT / SWT PROGRAMMING LANGUAGE




can scrollPane be resized automatically?

when we resize a JFrame, is it possible to resize the containing scroll pane with the frame automatically is there any function
VIEWS ON THIS POST

116

Posted on:

Monday 22nd October 2012
View Replies!

can this button be align at the top left coner of a container

import java.awt.event.*; import java.awt.*; import javax.swing.event.*; import javax.swing.*; public class HomePage extends JFrame { JFrame frame; public HomePage() { frame = new JFrame("Home"); frame.setBounds(100, 100,600,500); setGUIPanel(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private void setGUIPanel() { Container content = frame.getContentPane(); content.setLayout(new BorderLayout(10,10)); //create a Base panel to hold navigation and display panels JPanel basePanel = new JPanel(); basePanel.setLayout(new GridLayout(0,2,5,5)); content.add("Center",basePanel); //create left panel and it's components and //add to the Base panel JPanel navPanel = new JPanel(); //Dimension size = new Dimension(80,20); Box controlBox = Box.createVerticalBox(); JButton main = new JButton("Main"); //main.setPreferredSize(size); JButton employ = new JButton("Employee"); //employ.setPreferredSize(size); JButton admin = new JButton("Admin"); //admin.setPreferredSize(size); //add button to the BoxLayout controlBox.add(main); controlBox.add(employ); controlBox.add(admin); //add controlBox to navPanel navPanel.add(controlBox); //add navPanel to BasePanel basePanel.add(navPanel); frame.setVisible(true); } public static void main(String[] args) { HomePage hp = new HomePage(); } }
VIEWS ON THIS POST

102

Posted on:

Monday 22nd October 2012
View Replies!

How i can get Folder Explorer

hi does java has Folder Explorer like windows one (GUI) what is api name
VIEWS ON THIS POST

55

Posted on:

Monday 22nd October 2012
View Replies!

Why I cannot Move my JLabel after I add SetToolTipText()??

Dear Friends: I met a tough problem that I debugged for few days but cannot solve it. after I add SetToolTipText I cannot Move my JLabel , what is wrong here\t see code below, here label1 cannot move. If somebody can throw some lights, that will be wonderful, so far no progress. import java.awt.*; import java.awt.event.*; import java.util.Vector; import javax.swing.*; import javax.swing.border.LineBorder; import javax.swing.event.*; public class DNDJLabels extends JPanel { protected JLabel label1, label2, label3, label4; protected JLabel[] labels; protected JLabel selectedLabel; LineBorder black = new LineBorder(Color.black, 3, false); int cx, cy; protected Vector order = new Vector(); public static void main(String[] args) { JFrame f = new JFrame("Connecting Lines"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new DNDJLabels()); f.setSize(600,700); f.setLocation(200,200); f.setVisible(true); } public DNDJLabels () { setLayout(null); addLabels(); label1.setBounds( 125, 150, 150, 60); label2.setBounds(425, 150, 150, 60); label3.setBounds( 125, 575, 150, 60); label4.setBounds(425, 575, 150, 60); label1.setBorder(black); label2.setBorder(black); label3.setBorder(black); label4.setBorder(black); //add(btn); label1.setToolTipText("AAAAAAAA"); determineCenterOfComponents(); ComponentMover mover = new ComponentMover(); addMouseListener(mover); addMouseMotionListener(mover); } public void paintComponent(final Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON); Point[] p; g2.setStroke(new BasicStroke(4f)); for(int i = 0 ; i < order.size()-1; i++) { JLabel l1 = (JLabel)order.elementAt(i); JLabel l2 = (JLabel)order.elementAt(i+1); p = getCenterPoints(l1, l2); g2.setColor(Color.black); //g2.draw(new Line2D.Double(p[0], p[1])); } } private Point[] getCenterPoints(Component c1, Component c2) { Point p1 = new Point(), p2 = new Point(); Rectangle r1 = c1.getBounds(), r2 = c2.getBounds(); p1.x = r1.x + r1.width/2; p1.y = r1.y + r1.height/2; p2.x = r2.x + r2.width/2; p2.y = r2.y + r2.height/2; return new Point[] {p1, p2}; } private void determineCenterOfComponents() { int xMin = Integer.MAX_VALUE, yMin = Integer.MAX_VALUE, xMax = 0, yMax = 0; for(int i = 0; i < labels.length; i++) { Rectangle r = labels[i].getBounds(); if(r.x < xMin) xMin = r.x; if(r.y < yMin) yMin = r.y; if(r.x + r.width > xMax) xMax = r.x + r.width; if(r.y + r.height > yMax) yMax = r.y + r.height; } cx = xMin + (xMax - xMin)/2; cy = yMin + (yMax - yMin)/2; } private class ComponentMover extends MouseInputAdapter { Point offsetP = new Point(); boolean dragging; public void mousePressed(MouseEvent e) { Point p = e.getPoint(); for(int i = 0; i < labels.length; i++) { Rectangle r = labels[i].getBounds(); if(r.contains(p)) { selectedLabel = labels[i]; order.addElement(labels[i]); offsetP.x = p.x - r.x; offsetP.y = p.y - r.y; dragging = true; repaint(); //added break; } } } public void mouseReleased(MouseEvent e) { } public void mouseDragged(MouseEvent e) { Rectangle r = selectedLabel.getBounds(); r.x = e.getX() - offsetP.x; r.y = e.getY() - offsetP.y; selectedLabel.setBounds(r.x, r.y, r.width, r.height); //determineCenterOfComponents(); repaint(); } } private void addLabels() { label1 = new JLabel("Label 1"); label2 = new JLabel("Label 2"); label3 = new JLabel("Label 3"); label4 = new JLabel("Label 4"); labels = new JLabel[] { label1, label2, label3, label4 }; //add(btn); for(int i = 0; i < labels.length; i++) { labels[i].setHorizontalAlignment(SwingConstants.CENTER); labels[i].setBorder(BorderFactory.createEtchedBorder()); add(labels[i]); } } }
VIEWS ON THIS POST

82

Posted on:

Monday 22nd October 2012
View Replies!

Why can't I adjust my buttons location in the frame?

Hi . I can't seem to reallocate my buttons location with the current program format. I do not wish to use grid bag layout as I would attach some images and will be changing their location at some point of time. I'm using setBounds. Can someone help me understand why is that so The program I've attached is a small portion of it. import java.awt.*; import java.awt.event.*; import javax.swing.*; //Singapore news class UI2_SGNewsMenu extends JFrame { Color blue = new Color (0,0,255); Color violet = new Color (162,142,222); public Font originalfont = new Font("serif", Font.BOLD, 20); private static UI2_SGNewsMenu ui2_sgnewsmenu = new UI2_SGNewsMenu(); int clear,set; public JButton TvSeriesButton[] = new JButton[3]; int current2 = 0; public void checkclear() { TvSeriesButton[clear].setBackground(violet); } private void checkset() { TvSeriesButton[set].setBackground(blue); } private UI2_SGNewsMenu() { for(int i=0;i < TvSeriesButton.length;i++) { TvSeriesButton[i] = new JButton(); TvSeriesButton[i].setFont(originalfont); if(i>=1) { TvSeriesButton[i].setBackground(violet); } } TvSeriesButton[0].setBackground(blue); TvSeriesButton[0].setText("Prison Break"); TvSeriesButton[1].setText("Heroes"); TvSeriesButton[2].setText("SmallVille"); TvSeriesButton[0].setBounds(new Rectangle(256, 190, 180, 40)); TvSeriesButton[1].setBounds(new Rectangle(280, 250, 135, 31)); TvSeriesButton[2].setBounds(new Rectangle(280, 310, 135, 31)); JPanel sub2 = new JPanel(); sub2.add(TvSeriesButton[0]); sub2.add(TvSeriesButton[1]); sub2.add(TvSeriesButton[2]); setContentPane(sub2); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(1024,768); setFocusable(true); addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ESCAPE) { System.exit(0); } if(e.getKeyCode() == KeyEvent.VK_UP) { current2--; for (int x=0;x
VIEWS ON THIS POST

56

Posted on:

Monday 22nd October 2012
View Replies!

Is Swt how can i calculate the drop in DND action

im trying to make simple DND operation , dragging button from one side to composite now the DND is working great , but when i drop the button its always to fixed location in the composite control , i want to be able to drop it depending on where i drop the button that is any where in the composite area . how can i do that
VIEWS ON THIS POST

61

Posted on:

Monday 22nd October 2012
View Replies!

How can I split JButton? Any idea?

I just need a regular JButton that will differently respond if a user click at left or right half of the JButton. It will serve as "Back/Forward" buttons, but mixed into single JButton. Any idea on how to implement such functionality
VIEWS ON THIS POST

71

Posted on:

Monday 22nd October 2012
View Replies!

can anyone tell me books to refer for Swings

Need some input regarding the names of the books specifially for Swings. I am working with it, so I know the basics.But kindly suggest some book names which are not very huge .
VIEWS ON THIS POST

69

Posted on:

Monday 22nd October 2012
View Replies!

How i can make a JInternal frame to Doc in right side of my Jdesktop ?

Hi Thank you for reading my post is there any way to dock a JinternalFrame in a side of JDesktop component
VIEWS ON THIS POST

56

Posted on:

Monday 22nd October 2012
View Replies!

Which design pattern can be appied here?

Somthing like this TableModel --> dataFilter --> table1 table2 table 3 In a word, when set different condition in the dataFilter, it will have differnet tables. I think there is some design pattern can be appied here to make the design easily.
VIEWS ON THIS POST

63

Posted on:

Tuesday 23rd October 2012
View Replies!

how i can make a JinternalFrame un-moveable

Hi Thank you for reading my post How i can prevent users from moving a JInternalFrame in an JDesktop component I have several Internal frame inside a Jdesktop and i want some of them to be fixed in regard to their location.
VIEWS ON THIS POST

79

Posted on:

Tuesday 23rd October 2012
View Replies!

How can I send text characters to a printer device ?

If I want to write text characters to a file, I can try the following: BufferedWriter out = new BufferedWriter(new FileWriter("myFile.txt")); out.write(line1); out.write(line2); out.write(line3); (...) out.write(line999); out.flush(); out.close(); What should I change in the above lines in order to write streams of characters to a printer device instead of a file Please, keep in mind that I could need to print more than one page of text characters.
VIEWS ON THIS POST

66

Posted on:

Tuesday 23rd October 2012
View Replies!

Why my JSplitPane can't hide or show as I want?

import javax.swing.*; import java.awt.event.*; import java.awt.event.ActionEvent; import java.awt.BorderLayout; import java.awt.Dimension; public class SplitPaneTest implements ActionListener{ boolean show = false; JButton buttonB = new JButton("Show or Hide"); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); public SplitPaneTest() { JFrame frame = new JFrame("SplitPane show and hide test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultLookAndFeelDecorated(true); frame.setSize(500, 400); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); JButton button = new JButton("OK"); button.addActionListener(this); splitPane.add(button, JSplitPane.TOP); splitPane.add(buttonB, JSplitPane.BOTTOM); // splitPane.setResizeWeight(0.3); hide(); frame.getContentPane().add(splitPane, BorderLayout.CENTER); frame.setVisible(true); } public void actionPerformed(ActionEvent actionEvent) { if(show) { hide(); show = false; } else { show(); show = true; } } public void hide() { splitPane.setDividerLocation(1000); buttonB.setVisible(false); } public void show() { splitPane.setDividerLocation(20); buttonB.setVisible(true); } public static void main(String[] args) { new SplitPaneTest(); } }
VIEWS ON THIS POST

56

Posted on:

Tuesday 23rd October 2012
View Replies!

How to add a JButton to SplitPaneDivider? (why it can't work?)

Hi friends: In a JApplet, I want to add a JButton to SplitPaneDivider.But the code seem's don't work property. My code is: ////////////// TestApplet extends JApplet //////////////// public class TestApplet extends JApplet { public void paint(Graphics g) { JPanel f=new JPanel(); f.setPreferredSize(new Dimension(300,200)); f.setBackground(Color.green); f.setVisible(true); f.setLayout(new BorderLayout()); JButton jep=new JButton("b"); JSplitPane jspcontent=new JSplitPane(JSplitPane.VERTICAL_SPLIT,f,jep); jspcontent.setOneTouchExpandable(true); jspcontent.setDividerSize(50); BasicSplitPaneUI bspUI=(BasicSplitPaneUI)jspcontent.getUI(); JButton b=new JButton("test"); b.setVisible(true); BasicSplitPaneDivider divi=bspUI.getDivider(); divi.add(b); divi.setVisible(true); divi.validate(); this.setContentPane(jspcontent); this.setVisible(true); this.validate(); } } ///////////// end ////////////////// The divider can't display the JButton, why But in a frame (None JApplet ) application, it can work property. Does the JApplet can't use BasicSplitPaneDivider :roll: Thks!
VIEWS ON THIS POST

62

Posted on:

Tuesday 23rd October 2012
View Replies!

How can I get current File-Folder location during DnD outside JVM?

Greetings Ranchers, I want to have a Swing application from which I can drag & drop files between desktop & applications. Dragging and dropping files into JComponents is kind of well documented. But is there way to do the exact opposite copying someting from Swing application to JDesktop i.e creating a Transferable object using flavor DataFlavor.javaFileListFlavor If that is not possible is there way to find out what's file loctaion where drop is happening TIA
VIEWS ON THIS POST

60

Posted on:

Tuesday 23rd October 2012
View Replies!

help! I cant get this to paint

I need help getting this circle to appear when my circle button is pressed... I need the class headers to remain the same (unless adding extends or implements) because this is actually a piece of an assignment. I've been trying for hours and hours, but I cant get anything to appear! drawMain.java import javax.swing.*; public class drawMain { public drawMain() { myFrame frame = new myFrame(); frame.setVisible(true); } static public void main(String[] args) { new drawMain(); } }
VIEWS ON THIS POST

98

Posted on:

Tuesday 23rd October 2012
View Replies!

Why can't I get tooltip to show up when text in JTextField certain length?

I want to make a JToolTip show up (and formatted a certain way) when the text in a JTextField gets to a length beyond the visible horizontal length. I can make a window show up in this situation (i.e. I know how to test for the condition) but I can't get a tool tip to show up. I tried registering the text field with the ToolTipManager and then getting the "postTip" action and firing it's actionPerformed, but it didn't work. Any idea if there's a way JToolTip tip = textField.createToolTip(); ToolTipManager.sharedInstance().registerComponent( textField ); tip.setTipText( "blah" ); Action showAction = textField.getActionMap().get( "postTip" ); showAction.actionPerformed( new ActionEvent( textField, 0, ( String ) showAction.getValue( Action.NAME ) );
VIEWS ON THIS POST

79

Posted on:

Tuesday 23rd October 2012
View Replies!

can get label on second line

When I insert a label on frame I can insert on only one line how to get on next line is there any escape sequence like\t Like I want My name is jay. I am 21 years old but I am getting My name is jay. I am 21 years old Is there any way by which I can get label on second line
VIEWS ON THIS POST

66

Posted on:

Tuesday 23rd October 2012
View Replies!

Newbie, Please Help: Why can I not get the numbers to display

I have to write a program that shows three stations that collect numerical data for rainfall. I suppose to be able to put the number in and click enter and the number will show up in the box beside the input box. Then the input box goes back to 0.0, and anytime I add a number to it, it totals to the box on the right. What am I doing wrong Please help. I am running out of time. Here is the program I have written so far. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class FinalProject extends JFrame implements ActionListener { public static final int WIDTH = 550; public static final int HEIGHT = 100; private JTextField myNumberOut1; private JTextField myNumberIn1; private double sum=0; public FinalProject() { super("Eric Luce's Final Project"); setSize(WIDTH, HEIGHT); /** Setting Labels 1-3 for Stations */ JLabel myLabel1 = new JLabel ("Station Austin:"); JLabel myLabel2 = new JLabel ("Station Amherst:"); JLabel myLabel3 = new JLabel ("Station LaCrosse:"); /** Setting Buttons 1-3 for Adding NumberIn */ JButton myButton1 = new JButton ("Enter"); myButton1.addActionListener(this); myButton1.setBackground(Color.RED); JButton myButton2 = new JButton ("Enter"); myButton2.addActionListener(this); myButton2.setBackground(Color.WHITE); JButton myButton3 = new JButton ("Enter"); myButton3.addActionListener(this); myButton3.setBackground(Color.BLUE); /** Setting Labels 4-6 for Rain Fall totals */ JLabel myLabel4 = new JLabel ("Total Rainfall:"); JLabel myLabel5 = new JLabel ("Total Rainfall:"); JLabel myLabel6 = new JLabel ("Total Rainfall:"); /** Setting Text fields for NumberIn */ JTextField myNumberIn1 = new JTextField ("0.0", 10); JTextField myNumberIn2 = new JTextField ("0.0",10); JTextField myNumberIn3 = new JTextField ("0.0", 10); /** Setting Text fields for NumbersOut */ JTextField myNumberOut1 = new JTextField (); JTextField myNumberOut2 = new JTextField (); JTextField myNumberOut3 = new JTextField (); /** Adding contents to frame line 1 */ getContentPane().add(myLabel1); getContentPane().add(myNumberIn1); getContentPane().add(myButton1); getContentPane().add(myLabel4); getContentPane().add(myNumberOut1); /** Adding contents to frame line 2 */ getContentPane().add(myLabel2); getContentPane().add(myNumberIn2); getContentPane().add(myButton2); getContentPane().add(myLabel5); getContentPane().add(myNumberOut2); /** Adding contents to frame line 3 */ getContentPane().add(myLabel3); getContentPane().add(myNumberIn3); getContentPane().add(myButton3); getContentPane().add(myLabel6); getContentPane().add(myNumberOut3); Container contentPane = getContentPane(); contentPane.setBackground(Color.LIGHT_GRAY); contentPane.setLayout(new GridLayout(3, 5)); this.addWindowListener (new WindowAdapter(){ public void windowClosing(WindowEvent e){ } }); } public static void main (String[] args){ FinalProject mainFrame = new FinalProject(); mainFrame.setVisible(true); } public void actionPerformed(ActionEvent e){ { Container contentPane = getContentPane(); if (e.getActionCommand().equals ("ENTER")); contentPane.setBackground(Color.RED); sum = sum + myNumberIn1(); myNumberIn1.setText(Double.toString(sum)); myNumberOut1.setText(Double.toString(sum)); } } private static double stringToDouble(String stringObject) { return Double.parseDouble(stringObject.trim()); } }
VIEWS ON THIS POST

90

Posted on:

Tuesday 23rd October 2012
View Replies!

How can I build a custom image tooltip ?

How can I build a custom image tooltip As you know, we can set tooltip as text, but now I want to set an image as tooltip. How can I do that
VIEWS ON THIS POST

109

Posted on:

Tuesday 23rd October 2012
View Replies!