JButton 2 « Button « Java Swing Q&A





1. Problem with the JButton.    coderanch.com

1- i have 2 buttons, i want to add them to the same location, when i click on button1 then the button1 will hidden and show button2, when i click on button2 then button2 will hidden and show button1 again? please help me to slove my problem. 2- I have one button, but in this button i want to add 2 ...

2. to avoid grayed-out version of jbutton    coderanch.com

I am not using any where in my code setEnabled(false).I had written the focusLost event for the text field and doing the validation in the event.I am maintaining the focus in the text field itself.for the button i had written different event but that event is not invoked and the button is turning to grey

3. jbutton problem    coderanch.com

Im reading the dietel java book right now. On chapter 6 theres an example using a jbutton in a game of craps. The action listener is applied to the jbutton. My problem is this: in the actionlistener method, the first line is if (firstroll) call rolldice(); firstroll was initialized in the class as a boolean set = true the book explains ...

4. Usage of multiple JButtons    coderanch.com

Hello! It is better design to use inner classes imo. For example if you have a button like this JButton btnButton = new JButton(" I am a Friggin Button!"); I would recommend to add the action listener like this btnButton.addActionListener (new BtnListener()); So, in this case, you can make an inner clasw within the class of the GUI, however, I owuld ...

5. using jbutton to change New objects    coderanch.com

Hello, i am in the middle of writing a program in my free time (its a tile map thing). Having setup the creation of a "map" using arrays and nested loops, i wish to add a character to the map. I use jBuilder, and made a jButton that will perform an action when it is clicked. However, there is a problem! ...

6. JButton    coderanch.com

Alright, I have a simple one again. Actually, I'm not even sure if I can phrase it understandably, but I'll try. I have an ArrayList of a class that contains several variables. The class looks like this, if that helps. It's a list of plants with different attributes: public class Pflanzentyp { String name = ""; int zbaseite = 0; String ...

7. JButton button    coderanch.com

This code compiles and runs fine. But if inside the go method while creating the instance of JButton if we mention it like JButton button = new JButton("click this") then it throws nullPointerException when we click on the button. I am not able to understand what is going wrong if reference type is also mentioned during the instance creation. Thank you ...

8. JButton to send automatic email    coderanch.com

Hello! Just want to ask if there is a way that my JButton's action could be that I will send an automatic email with automatic content (a string or a text attachment)? As of now, I am doing it via: Runtime.getRuntime().exec(new String[] {"rundll32", "url.dll,FileProtocolHandler", "mailto:emailAdd@yahoo.com" + "&subject=glosariSuggestion&attachment=" + "\"" + "suggestions.txt" + "\""}, null); but this opens a microsoft outlook window. ...

9. JAVA JButton Functionality    coderanch.com

Basic Problem: I have a problem understanding how to import the JList Vector Array from a mandatory, external class named MovieInfo.Java that cannot change. I am really boggled right now. To see my assignment visually, please read the SCRIBD file. :P URL: http://www.scribd.com/doc/13082448/CSIS1275Assign3w2009 So, the teacher wants me to click on the button 'Click For Movies'. Once clicked on, it will ...





10. JButton that runs another Java program    coderanch.com

Hello all. I am currently working on a Java project that is due to be completed soon (so I may have a few questions at a later date). Admitedly, I'm not very good at programming and much of my code so far is a bit of a mish mash of stuff that I have found by searching the net. I have ...

11. Doubt using JButton    coderanch.com

I have 3 buttons Each of which on clicking would give the label of corresponding button name and a Back Button which on clicking would go through all the label names of the buttons which are clicked previously each time it is clicked. How to give the functionality for Back Button listener? Appreciate any help!!

12. JButton Problem ?    coderanch.com

package Panel; import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.sql.*; import java.text.*; public class RestaurantPlan extends JPanel implements ActionListener { PreparedStatement pstmtSubmit; static String[] seat = {"1","2","3","4","5","6","7","8","9","10"}; JLabel jlbCashier = new JLabel("Cashier"); JLabel jlbRestroom = new JLabel("Female"); JLabel jlbRestroom2 = new JLabel("Male"); JLabel jlbMainDoor = new JLabel("Main Door"); JLabel jlbTitle = new JLabel("Reservation Details"); JLabel jlbDate = new JLabel("Date: "); JLabel ...

14. How is a Graphical object move on the Screen by using JButton.    coderanch.com

How is a Graphical object move on the Screen by using JButton until the button release. class LeftRightMover extends JFrame{ JButton left=new JButton("Left"),right=new JButton("Right"); JComponent movingthing; JLayeredPane pane=new JLayeredPane(); JLayeredPane frame=new JLayeredPane(); public LeftRightMover(){ this.setSize(400,120); this.setResizable(false); setContentPane(pane); movingthing=new JComponent() { public void paint(Graphics g){ g.setColor(Color.GREEN); g.fill3DRect((movingthing.getWidth()/2)-25, (movingthing.getHeight()/2)-25, 50, 50, true); }}; left.setBounds((getWidth()/2)-102,getHeight()-50,100,20); right.setBounds((getWidth()/2)+2,getHeight()-50,100,20); movingthing.setBounds((getWidth()/2)-25,getY()+10,50,50); frame.setBounds(-1,getY()+9,getWidth(),52); frame.setBorder(new javax.swing.border.LineBorder(Color.BLACK)); getContentPane().add(frame); getContentPane().add(movingthing,0); getContentPane().add(left,0); getContentPane().add(right,0); ...

15. JButtons.... nothing to do with GUI    coderanch.com

Hey... so i have to create this application that i create an array and the array represents an apartment building. I have to read in the location in the array which represents the apartment number, as well as the number of occupants in the apartment. This all has to be done through GUI. Here is what I have so far... import ...

16. Change JButton look    coderanch.com





17. JButton Got Hanged    coderanch.com

18. Help with this JButton Save code!    coderanch.com

I have been working on this project for over a week, and with this last part, i am almost done! This is the only hard part left, but i just need some help with how to do it! I have to have a JButton, that when pressed, runs a save code that will save 2 different Strings. I know how JButtons ...

19. Use JButton to pass value to nextInt()    coderanch.com

Thanks Jesper, here is my code I will explain what I wanna do in //comment public class Projexs { JTextArea text; String output = ""; int input =0; public boolean Stop = false; public static void main(String[] args) { Projexs crab = new Projexs(); Pattern pattern = crab.getPattern(); Player player = new Player(); System.out.print("The MIDI File has been saved"); try { ...

20. JButton Quick Help    coderanch.com

21. Creating and manipulating buttons using JButton....    coderanch.com

So, this is for a beginner java class, and I'm struggling. Basically, we have an array full of different albums and information about them, and now I need to create a GUI that allows a user to move next, previous, first, and last. It seems simple enough, but I'm a little bit confused, I can't seem to wrap my head around ...

22. jbuttons    coderanch.com

Hi, I am trying to implement an action listener for an array of Jbutton without name. I want the first button to display A, second to display B.... I know that this code displays A which ever button I press. I am unable to come up with any idea please help me. for (int i = 0; i < whites.length; i++) ...

23. JButton Syntax Question    coderanch.com

24. JButtons inside JTooltip    coderanch.com

import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class ToolTipWithButtons { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new ToolTipWithButtons().makeUI(); } }); } public void makeUI() { JLabel label = new JLabel("Mouse here") { JToolTip toolTip; @Override public JToolTip createToolTip() { if (toolTip == null) { JPanel panel = new JPanel(new GridLayout(0, 1)); for ...

25. How to make JButtons working together?    coderanch.com

26. Jbutton not working??    java-forums.org

Hi my question is pretty simple. I cannot figure out why my JButton is not working and I will be honest this is the first time I have ever used one in a program. I would like to know either what is wrong or the area where I need to narrow my focus. Any help is greatly appreciated. import java.awt.Color; import ...

27. Problem with JButton    java-forums.org

import javax.swing.*; import java.awt.*; import java.awt.geom.*; import java.awt.event.*; public class antras extends JApplet { private Rectangle2D Shape4; public antras () { setBackground( Color.black ); Shape4 = new Rectangle2D.Float (10.F, 10.F, 480.F, 280.F); } public void paint (Graphics g) { Graphics2D g2D; boolean Contained; g2D = (Graphics2D) g; g2D.setColor(Color.white); g2D.fill (Shape4); Contained = Shape4.intersectsLine (400., 10., 480., 70.); //first action g2D.setColor (Color.green); ...

28. JButton Problem    java-forums.org

Hello , i'm a new a java beginner user... i'm trying to create a JButton that it contain x^2 , i want the number 2 to appear like a superscript . also i have a text field , and i want to display a text with a multiple color in the same text field .... so how can i do this ...

29. Applying Vista Buttons for Java JButton    java-forums.org

To Mr. Viswanadh: cross-posting can frustrate anyone who tries to help you only to find out later that the same answer was given hours ago in a cross-posted thread. No one likes wasting their time, especially a volunteer. The polite thing to do would be to not do this, but if you feel that you absolutely must, to at least provide ...

30. JButtons in a straight line on the BOTTOM    java-forums.org

In layouts like FlowLayout, i have searched through google and many other places but can not find the answer to what I am looking for: Is it possible to make a bunch of JButtons in a straight line on the BOTTOM of the page, and then ONE button at the top? How can i get a row of buttons to appear ...

31. Jbutton do not show up    java-forums.org

Hi, I have defined a JPanel in my code which conains some buttons but some times the buttons in the panel are not displayed or only few of them are dipslyed.Most of the times it functions properly and i am able to see all the buttons. Here is the code - protected JPanel DialPanel; protected JButton m_btn1; protected JButton m_btn2; DialPanel ...

32. JButton help :)    java-forums.org

import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.*; //for map public class Hangman { public static void main(String[] args) { JFrame frame = new JFrame("Guessing Game"); frame.setVisible(true); frame.setSize(400, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel buttons = new JPanel(); frame.add(buttons); buttons.setLayout(new GridLayout(3, 7)); buttons.add(new JButton("A")); buttons.add(new JButton("B")); buttons.add(new JButton("C")); // for empty cell buttons.add(new JButton("D")); buttons.add(new JButton("E")); buttons.add(new JButton("F")); buttons.add(new JButton("G")); buttons.add(new JButton("H")); ...

33. help with lab - JButton not working    java-forums.org

Can anybody here help me with this? this is a lab for my comp science class where we have to make a little form for title (mr. and mrs.), name, address and such and have it print out. for some reason though i cant figure out why the clear and submit buttons do nothing heres the code: Java Code: public class ...

34. Interesting JButton Query    java-forums.org

Well i am trying on my project and i have completed it But looking it as per GUI application i want to hide the JButton's text and only Image Icon should be visible And the interesting clause is that the JButton name should not be NULL or "" it shud be the name that i have entered Eg: JButton b=new JButton("Button",new ...

35. Again Interesting JButton Query    java-forums.org

36. JButton Help    java-forums.org

Cross-posted. Ravjot: cross-posting can frustrate anyone who tries to help you only to find out later that the same answer was given hours ago in a cross-posted thread. No one likes wasting their time, especially a volunteer. The polite thing to do would be to not do this, but if you feel that you absolutely must, to at least provide links ...

37. JButton.setBackground() Problem    java-forums.org

Hi All, When i apply the setBackground() Method to a JButton to set its Background, i face i Problem : Under Mac Os : The JButton DOSE NOT change its color, when i take my code to my other computer under Windows : OK, the JButton change... i am wondering .... 1) Why under my Mac OS i face this problem... ...

38. Creating shortcutkey for jbutton    java-forums.org

I want to know how to create short key for jbutton without using mnemonics and i`ve used this code KeyboardFocusManager.getCurrentKeyboardFocusManage r() .addKeyEventDispatcher(new KeyEventDispatcher() { public boolean dispatchKeyEvent(KeyEvent e) { int c=e.getKeyCode(); if(c==KeyEvent.VK_F2) JOptionPane.showMessageDialog(rootPane,"Selected); return false; } }); } This code works,but if i press f2 for two time two MessageDialog Box are show . I want to know how to set ...

39. my JButtons won't show up    java-forums.org

Hello, Please have a look at this screen capture of a JFrame I'm programming: You'll notice that there are no buttons on the right hand side. This is a problem. I'm trying to create a JPanel to the right of the maze you see in the middle with two buttons in it, and nothing's showing up. Here's the code for the ...

40. Please help!JButtons    java-forums.org

hi guys i need help ..i need to put a JButton in my project.... this must be the output of the program when you click the Day button the Moon will hide and the background will turn to white same as the Moon when you click it the the sun will hide and the background will turn to black... this is ...

41. pack() method for JButton?    java-forums.org

Is there anything in the JButton class that acts like JFrame's pack() method? I'm looking for something that does two things: 1) automatically sizes the button to fit its text snugly and doesn't crop it. 2) minimizes the overall size of the button so that the text is still fully visible (i.e. not cropped) yet no space surrounding the text is ...

42. JButton setColor problems    java-forums.org

private class ColorButtonListener implements ActionListener { public void actionPerformed(ActionEvent e) { if (colorCounter==0) { button1.setBackground(Color.ORANGE); colorCounter++; } else if (colorCounter==1) { button1.setBackground(Color.YELLOW); colorCounter++; } else if (colorCounter==2) { button1.setBackground(Color.CYAN); colorCounter++; } else if (colorCounter==3) { button1.setBackground(Color.LIGHT_GRAY); colorCounter++; } else if (colorCounter==4) { button1.setBackground(Color.GRAY); colorCounter++; } else if (colorCounter==5) { button1.setBackground(Color.BLACK); colorCounter=0; } }

43. Jbutton problem    java-forums.org

I cannot get a JButton to resize...can anyone tell me what is wrong with using Button1.setBounds(1,1,2,2);...below is the class file...it is called from another file...it gives and error that I posted after the code Java Code: import java.awt.*; import javax.swing.*; //this is required for gui layout import java.awt.event.ActionListener; //this is required for the buttons to work import java.awt.event.ActionEvent; //this is required ...

44. JButton Restart doesn't work    java-forums.org

JButton Restart doesn't work hi at all, i'm trying to solve my problems, sorry for any grammatical errors, but i'm not english, so. i need to run a JButton restart to my "project".. it's like a tic tac toe... i want that the button when clicked start a new game.. it now do this.. but it have some bugs.. ...

45. JButton and Command Pattern help URGENT    java-forums.org

Hi, I am making a GUI which implements a command pattern that will output a simple message saying "hello". I have a class Client within a package gmit. I have a button called connect which does the following: class connect implements ActionListener{ public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub Command command = (Command)e.getSource(); command.run(); } } every time ...

46. Regarding JButton    java-forums.org

I have a JScroll Pane in a page . I have disaibled it . Now problem is i have placed Two buttons , Instead of scrolling i want to use those two buttons and want to Scroll up and down (not by JScroll Pane ) I dont know wat to put in the Action event handler of that UP button And ...

47. Problem with JButton    java-forums.org

48. jbuttons    java-forums.org

49. JButton Problems    java-forums.org

50. Adding JPEG to JButton Child    java-forums.org

Hello, I am new to Swing and trying to improve my java by writing a chess program. I coded in the chess logic into an array of integers representing piece types. I then created a Swing GUI JFrame with an 8x8 grid layout of a class that extends JButton that handles mouse events. Currently, this grid is interactive and uses setText ...

51. Jbutton to destroy process    java-forums.org

52. New AWT/SWING user, help in JButton    java-forums.org

public void paintComponent(Graphics g){ super.paintComponent(g); if(copyright) g.drawImage(title,50,30,this); else if(titleScreen){ g.drawImage(javam,70,25,this); g.drawImage(catc,90,140,this); } else if(insScreen) { g.setColor(Color.green); g.fillRect(0,0,600,600); g.drawImage(oak,25,100,this); } else if(gameStart) { g.setColor(Color.blue); g.fillRect(0,0,600,600); } canvas.repaint(); } public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if(titleScreen && command.equals("Instructions")) { insScreen = true; titleScreen = false; } else if(titleScreen && command.equals("New Game")) { gameStart = true; titleScreen = false; } canvas.repaint(); ...

53. Need help finding mouseMoved on a JButton    java-forums.org

54. Need help with assignment - JButton    java-forums.org

hi there, can somebody help me fix my code? so my assignment is to write a GUI application that lets users select one of the two shapes and draw the shape. The user can select either a Circle, or a Triangle. After one of the shapes is selected, the user can draw it as follow: when Circle is selected, let the ...

55. Custom JButton    java-forums.org

I would like to create a new button like this one Google Images. Should i Override paintComponent() ? If yes, how exactly ? EDIT: I managed to create the button, here is the code: Java Code: import javax.swing.*; import java.awt.*; import java.awt.geom.RoundRectangle2D; public class JRButton extends JButton { private int w ; private int h ; private RoundRectangle2D re; private final ...

56. JButton onClick?    java-forums.org

57. Adding variables to JButtons    java-forums.org

58. JButton    java-forums.org

59. jbutton    java-forums.org

60. placing JButtons with x and y coords (possible?)    java-forums.org

You can set the absolute position of buttons, labels, etc via a null layout. If you do this, you are responsible for not only the placement of the components but also their sizes, and this can be done with one shot via the Component method setBounds(int x, int y, int width, int height). Having said this, I recommend against doing it ...

61. JButtons and If statements    java-forums.org

Hi - I'm back. No surprise there. I am trying to write a program that calculates the number of gallons * the selected FuelTypeRadioButton. I have everything in place - but the calculation is not recognizing the "IF SELECTED" statements. I've highlighted where I think I've gone wrong. :confused: RED Java Code: import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.text.*; import ...

62. A problem with JScrollBar and the Jbutton    java-forums.org

63. Help; Missing JButtons    java-forums.org

Can some one please help me figure out why my JButtons dont show up in my Applet? Every thing compiles and runs fine, but with no buttons import java.text.*; // Import Text Formatting import java.text.DecimalFormat; import java.math.*; // import java.io.*; import java.awt.*; // Import Layout import java.awt.event.*; // Import Event Handlers import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; // Import GUI Components ...

64. JButton doesn't disappear when it is supposed to?    java-forums.org

panel5 = new JPanel(); //Panel for getting info on student studentNameLabel2 = new JLabel("Student Info is displayed here"); studentInfo = new JTextArea(); studentInfo.setColumns(40); studentInfo.setLineWrap(true); studentInfo.setRows(36); studentInfo.setWrapStyleWord(true); studentInfo.setEditable(false); studentInfoScroll = new JScrollPane(studentInfo); studentInfoScroll.createVerticalScrollBar(); editStuds = new JButton("Edit Students"); editStuds.addActionListener(this); doneStudEdit = new JButton("Done Editing"); doneStudEdit.setVisible(false); panel5.add(studentNameLabel2); panel5.add(studentInfoScroll); panel5.add(studentInfo); panel5.add(editStuds); panel5.add(doneStudEdit); public void actionPerformed(ActionEvent e) { if (e.getSource() == editStuds) { doneStudEdit.setVisible(true); studentInfo.setEditable(true); ...

65. How to use JButtons from a different class    java-forums.org

public class Buttons extends JPanel { JPanel panel = new JPanel(); JFrame frame = new JFrame(); private JButton addButton; private JButton modifyButton; private JButton deleteButton; public JButton getAdd() { return addButton; } public Buttons() { super(); addButton = new JButton("Add"); modifyButton = new JButton("Modify"); deleteButton = new JButton("Delete"); panel.setLayout(new FlowLayout()); panel.add(addButton); panel.add(modifyButton); panel.add(deleteButton); add(panel); } }

66. JButton issue    java-forums.org

import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Layout1 { public static void main(String [] args) { MyFrame frame = new MyFrame("Alan Window"); frame.setSize(400, 300); frame.setLocation(100, 75); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } class MyFrame extends JFrame { JPanel pan = new JPanel(); JRadioButton Rbtn = new JRadioButton("One", true); JTextField txt1 = new JTextField("one"); JTextField txt2 = new JTextField("two"); JTextField txt3 = new ...

67. how to link an object to a JButton    java-forums.org

Hi, I'm making an application that controls a wireless network. When I refresh the network the app creates a JButton for each node detected. Those buttons can be moved arround the screen because there is a image of a map underneath them. Then thing is that I need that when I push a node button I need to open a new ...

68. Implementing JButton in this circumstance.    java-forums.org

Hi all; I am new to Java, and definitely new to Swing. Basically, I am working on a University assignment that involves creating a game of Higher or Lower (the card game). Very simple I know. In the below code, I am taking input at the command line to choose the outcome of the conditionals. My question is, how can I ...

69. JButton help    java-forums.org

package counter; import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class DrawPanel extends JFrame implements ActionListener{ public Container cp; JButton switchToMain = new JButton("Switch to Main Menu"); JButton switchToDnd = new JButton("Swtich to DnD"); public DrawPanel(){ cp = getContentPane(); cp.setBackground(Color.BLACK); cp.setLayout(new FlowLayout()); cp.add(switchToMain); switchToMain.addActionListener(this); switchToDnd.addActionListener(this); } public void actionPerformed(ActionEvent e) { System.out.println("Hello"); if(e.getSource() == ...

70. JButton help    java-forums.org

71. What am I doing wrong here? (JButton issue)    java-forums.org

I've been trying to troubleshoot this and I cannot seem to figure out what I am doing wrong. There are only two errors (that I know of) in this code. I can't seem to understand why button.length in "for (int i = 0; i <=button.length; i++)" is underlined as an error and why the line after that "button = new JButton(button[i]);" ...

72. Add GCanvas to JButton?    java-forums.org

Hey everyone! I'm fairly new to java. I have only taken one class and am attempting to use the knowledge in building me a nice chess game. So far I have some nice JButtons that make my 8x8 grid, colored appropriately with white and black jpgs. The buttons are attached to actionCommands that give a strings based on location on the ...

73. Runnable JButton takes too much memory <-- Alternative?    java-forums.org

So I got this custom made JButton that shows an animation when you put the mouse on it (in this case a sine wave propels). Now with 8 buttons of this type (the amount I'd like to use) in one JPanel this tends to give me a very slow JApplet. Thus what are alternatives I can use to get this animation? ...

74. jbutton calculation    java-forums.org

Hey guys, I know this may seem like a very dumb question but i am wondering how to make an action happen once i press a button on my jframe. For example, if i press the button i've named calculate, i want it to be able to take values from two texts boxes and multiply them. My biggest setback is that ...

75. JButton's dont appear    java-forums.org

import javax.swing.*; class Buttons extends JFrame { JPanel pnl = new JPanel(); ImageIcon tick = new ImageIcon("tick.png"); ImageIcon cross = new ImageIcon("cross.png"); JButton btn = new JButton("Click Me"); JButton tickBtn = new JButton(tick); JButton crossBtn = new JButton("STOP", cross); public Buttons() { super("Swing Window"); setSize(500, 200); setDefaultCloseOperation(EXIT_ON_CLOSE); add(pnl); setVisible(true); pnl.add(btn); pnl.add(tickBtn); pnl.add(crossBtn); } public static void main (String[] args) { Window ...

76. JButton help    java-forums.org

Why am I getting an error here? import javax.swing.JFrame; import javax.swing.JButton; import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Event4 extends JFrame { private JButton myButton; public static void main (String[ ] args) { JFrame f = new Event4( ); f.setDefaultCloseOperation(EXIT_ON_CLOSE); f.setSize(250,170); f.setVisible(true); } public Event4( ) { super("Event Demo 4"); getContentPane( ).setLayout(new FlowLayout( )); myButton = new JButton("Example"); myButton.addActionListener(this); getContentPane( ...

77. JButton Input    java-forums.org

Your question has several parts, and to better help you, we really need to know which specific part has you stumped. Have you read the Java Swing tutorials on how to use JButtons? Do you know how to add ActionListeners to JButtons? Do you know how to show a JOptionPane? A JDialog? Best of all, could you show us what you've ...

79. SetBounds for a JButton    forums.oracle.com

80. is it the correct way to use setrolloverenabled in JButton() ??    forums.oracle.com

i am unable to create rollover icons for the Jbuttons. The program isnt showing any errors but its not displaying rollover icons. Should i add anything extra for the code below ?? pls check the code below public void createGUI() { setLayout(new FlowLayout()); b1=new JButton("Submit"); b1.setRolloverEnabled(true); b1.setRolloverIcon(new ImageIcon("warning.gif")); add(b1); } this method is written in class extending JApplet Thanks for all ...

81. Make JButton uneditable !!!    forums.oracle.com

82. Help with a JButton/ArrayList problem, please    forums.oracle.com

I'm familiar with that, it's printed out and pinned to the table next to me. What I'm having a problem with is the assembly of the statement that will: name the button (b1 - b12) add the button to my buttonPanel attach the listener to my button. the get method isn't sparking any ideas as to how to do the above. ...

83. Help with JButton    forums.oracle.com

One problem that I see is that you are trying to do everything in one class, and in fact everything is being done with in the static world. You need to use true OOP classes, and divide and conquer your problems. File reading / data acquisition should be done by one class, GUI display by another, etc... then you can debug ...

84. JButton issue    forums.oracle.com

85. JButton Question?    forums.oracle.com

86. JButton problem.Please Help.    forums.oracle.com

I have an applet with jbutton that says press.Each time I press it should display a word, but with a different color.I only need to press it a couple of times.My code looks something like this.The problem is it just displays the green text.How do I make it so when I first click it , it shows blue text, and when ...

87. jButton problem    forums.oracle.com

} public void actionPerformed(ActionEvent e) { new BorderLayoutExample(this); } } this is the code i am using for the first frame(where i want to have 2-3 buttons).So far i got one method (public void actionPerformed...)which displays my second frame(named BorderLayoutExample) and the first jButton uses(northButton.addActionListener(this);) that method. The other jButton for example should lets say close the frame. I have an ...

88. JButtons    forums.oracle.com

I'm currently making a replica of Minesweeper for a computer science homework at college and need advice on how to use JButtons. I want to somehow give coordinates to a JButton, meaning I want a way to distinguish each JButton from the others so that I can pass parameters to a method like explore(int i, int j) to "explore" a specific ...

89. How can i change the JButton look?    forums.oracle.com

90. How to get name from JButton?    forums.oracle.com

getActionCommand is a method of JButton (AbstractButton in fact). I'm not sure if getActionCommand of ActionEvent return the value you have set to the button. As you can retrieve the button with e.getSource(), there is no doubt about using ((JButton)e.getsource()).getActionCommand() which will return the value set with button1.setActionCommand("enable"); If you can compare the results, I'm interested to know if e.getActionCommand() and ...

91. JButton ---- HELP please    forums.oracle.com

Hi good guys, am developing an application in java. I have added a button to panel which in turn is added to a frame. My problem is when i add the button(button with an image of icon of 19X19) to the panel(frame), it covers the whole frame. I want the button to be just small as it is in the frame ...

92. Problem with JButton    forums.oracle.com

I have a JButton1 that when clicked does the following: 1. Connects to a Windows file server by Windows API WNetAddConnection2 function. 2. Copy files from the server to local drive. I used FileChannel to copy files from the server. I also have a JButton2 that you can click to cancel the above operation. The problem is when the JButton1 is ...

93. Jbutton    forums.oracle.com

94. Need help with JButtons    forums.oracle.com

95. gui jbuttons    forums.oracle.com

Hi, I am very new to java gui and would like to create a simple gui application. it should display 3 buttons. next button at the bottom. button1 at some location and button2 at some location. when you hit next button the two other buttons will appear in a different location (their distance has to be greater than the previous locations). ...

96. JButton Help...Please    forums.oracle.com

// Load the Display Icon logo = new ImageIcon( getClass().getResource( "logo.gif" ) ); Icon iconNext = new ImageIcon( getClass().getResource( "forward.gif" ) ); Icon iconPrev = new ImageIcon( getClass().getResource( "back.gif" ) ); Icon iconLast = new ImageIcon( getClass().getResource( "last.gif" ) ); Icon iconFirst = new ImageIcon( getClass().getResource( "first.gif" ) ); Icon iconAdd = new ImageIcon( getClass().getResource( "add.gif" ) ); Icon iconDelete = ...

97. Repost: JButton Help    forums.oracle.com

// Load the Display Icon logo = new ImageIcon( getClass().getResource( "logo.gif" ) ); Icon iconNext = new ImageIcon( getClass().getResource( "forward.gif" ) ); Icon iconPrev = new ImageIcon( getClass().getResource( "back.gif" ) ); Icon iconLast = new ImageIcon( getClass().getResource( "last.gif" ) ); Icon iconFirst = new ImageIcon( getClass().getResource( "first.gif" ) ); Icon iconAdd = new ImageIcon( getClass().getResource( "add.gif" ) ); Icon iconDelete = ...

98. Help with JButtons    forums.oracle.com

99. I need heed help for Handle the JButton    forums.oracle.com

are you trying to load a multi line textfile int a JTextField? If you try to load this in a while loop as you read the file, it will zoom through the file, and you will probably only see the last line of the file (or nothing if the last line is blank) in the jtextfield. Consider using a JTextArea or ...

100. jbutton    forums.oracle.com

Can anyone help me, I am trying to create a gui, that has jbuttons on the frame but each time the frame is displayed each jbutton has a different randomised word, taken from an array or list, I cannot find a way to set the jbutton text to anything more than just a string that stays with the jbutton each time ...