33 Topics

Member Avatar for
Member Avatar for andruluchko

Hello, I try to rename file or directory using JFileChooser() and JButton(). But it gives me a NullPointer exeption. I have FileChooser, Button and TextField where I write new name for my file or directory. Can you say where I go wrong and how to solve this problem. // button …

Member Avatar for mKorbel
0
1K
Member Avatar for moaz.amin.37

hello to all i have problem about button events the problem is that if i handle an event of button and show again a window(result of event) that also has buttons then how to handle events of buttons of second window please help me

Member Avatar for mKorbel
0
161
Member Avatar for kristian.ssyn

I've been trying to resize my jbuttons to the size of my pictures, but the jbuttons keep on occupying the whole frame. The size of the photos are 150x267. import javax.swing.*; import java.awt.event.KeyListener; import java.awt.*; import java.awt.event.KeyEvent; import java.util.Timer; import java.util.TimerTask; public class StartGame extends JFrame implements KeyListener { Timer …

Member Avatar for JamesCherrill
0
12K
Member Avatar for phoenix_2000

Heya all, I'm working on a small 'file browser', where the list of files is printed in a console (for now), but where the user inserts the file's path in a GUI. My gui is rather simple: one frame and one panel containing a JTextField and a JButton. I want …

Member Avatar for phoenix_2000
0
264
Member Avatar for Ann aiko

import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JComboBox; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; public class OtakuHigh extends JFrame{ private JLabel label, label1, label2, label3, label4, label5, label6, label7, label8; private JTextField text1, text2, text4, text5, text7, text8; private JComboBox Mbox, Dbox, Sbox, Ybox, SCbox; private JButton Qbutton; …

Member Avatar for mKorbel
0
211
Member Avatar for andymarin

Hi guys, I'm having trouble with my code and I'm kind of new in Java so I don't know what to do. I have to do a program with Buttons and each button has to take me to another class (I don't know if I'm being clear). For example if …

Member Avatar for andymarin
0
703
Member Avatar for milkman93

Hey everyone, I want to add action listeners to JButtons that were created dynamically by an ArrayList. Here is the code for the button creation. numOfCourse = 6; courseBtnArray.add(new JButton("Course 1")); gbc.gridx = 2; for (int i = 0; i < numOfCourses; i++) { gbc.gridy++; add(courseBtnArray.get(i), gbc); courseBtnArray.add(new JButton("Course " …

Member Avatar for mKorbel
0
484
Member Avatar for fallen21468

Ok so I am trying to build a little program and I want to be able to click on the skate or dice button and have the program open a new JFrame that has been built in another class. Currently it opens its own JFrame that was built in this …

Member Avatar for fallen21468
0
1K
Member Avatar for psy.blast

Hello DaniwWeb Members :) I'm a fairly new programmer and I'm kinda embarressed to ask this question considering that the answer is probably blatently obvious. So forgive my ignorance :) But here goes, I have a String called "Ctype", It is relevant to my combobox which I created. My combobox …

Member Avatar for JamesCherrill
0
207
Member Avatar for 47pirates
Member Avatar for Zaad
-1
210
Member Avatar for 47pirates

there are two panel in one panel there is search button and in the another one there is Jtable for displaying search result. In that jtable initially all the records are displayed. But when i try to search, it works but the problem is that i need to click search …

Member Avatar for 47pirates
0
423
Member Avatar for jonny93

Hello, I'm new to this site, and i really need help with something. I have been working on a checkerboard project for my second programming class, and now I'm stuck. I now how to set the icons, but now I am absolutely confounded as to how I move the icon …

Member Avatar for NormR1
0
2K
Member Avatar for Steve2490

Ive created a memory game which has a grid of JButtons, when the button is clicked it changes the ImageIcon background to an animation which shows the front of the card. The problem is that when the button is clicked, the gif doesn't begin playing until the mouse is moved …

Member Avatar for mKorbel
0
755
Member Avatar for cadamsjr

Hi everyone, I have a javascript, jQuery, and c++ background so im not completely new but am just starting to learn Java in a University setting. In our first program we are to run it within a Do...While loop so the user can click a JButton for yes or no, …

Member Avatar for cadamsjr
0
190
Member Avatar for 65piano

First of all, I'm new to GUI so I may have made some terrible mistakes.. right, so I have a two dimensional array of buttons and I need to identify which button in the array is clicked, hovered over, and hovered off. For now I just want my program to …

Member Avatar for JamesCherrill
0
187
Member Avatar for upanotch

I tried to put an image on a JButton and it's messed up: [url]http://imgur.com/ecBOt[/url] code: [CODE]import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; public class Polluted extends JFrame implements ActionListener { ImageIcon bg = new ImageIcon("bg.png"); Image bgImage = bg.getImage(); public static void main(String[] args) { new Polluted(); } public …

Member Avatar for NormR1
0
170
Member Avatar for c.uetn

Help with java Button How about I'm making a music player but I like the look of the button you added the image as ImageIcon because for example the play button is round and I want to lose those edges rectangular button and wanted to find a way to insert …

Member Avatar for c.uetn
0
506
Member Avatar for ashsailesh

i am using an array of JButtons b[23].... my objective is that when i click a button it has to change its background color to black but it is giving a nullpointer exception.... if(ae.getActionCommand().equals("0")) { System.out.println("button b[o] is pressed"); b[0].setBackground(Color.black); } } can anyone help me with this please........

Member Avatar for hfx642
0
122
Member Avatar for baby_c

Hello friends.I got some problems with a program I'm developing for a assignment. I want to add a image(background) to my Jframe and add some buttons. I wrote the code. I can load image into the frame but when I create the Jbutton and re-size it to smaller button it's …

Member Avatar for baby_c
0
27K
Member Avatar for ecclesiastes3:1

Good Day... the problem is that the Jbutton is not displaying in my Jpanel. can you help me, this will help me a lot, Thanks Here's the code [CODE] import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URL; import javax.swing.JButton; import javax.swing.JOptionPane; public class GameBoard extends JPanel implements ActionListener { JButton …

Member Avatar for ecclesiastes3:1
0
294
Member Avatar for bangor_boy

I have been playing about with some code tonight and trying to add things to it, so i know it wont make sense when talking about cats and dogs, females and males and music, I run this code and the GUI comes up I click add CD and the required …

Member Avatar for NormR1
0
821
Member Avatar for matadori

I'm trying to remove a JButton from a JPanel but my code does not work. Any help is appreciated. This is the JButton. Problem is the line 25 I guess. [CODE] class SquareButton extends JButton implements MouseListener { String text = null; GameArea ga = null; public SquareButton(GameArea ga) { …

Member Avatar for mKorbel
0
2K
Member Avatar for SMITA6076

I have a [ICODE]JFrame[/ICODE] window to which I am trying to add 3 panels. One panel is for input (text areas and their labels which I already have arranged within the panel), one is for a set of buttons, and one is for output. I want the the input and …

Member Avatar for JamesCherrill
0
386
Member Avatar for ekin5683

[CODE]mport java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.*; import java.awt.*; import javax.swing.ImageIcon; import javax.swing.JApplet; import javax.swing.JButton; public class Main extends JApplet implements ActionListener,ItemListener { //private Image im; // image handler //private static final String IMAGE = "enviro2.jpg"; //starFish tapakSulaiman = new starFish(this); public void init() { …

Member Avatar for mKorbel
0
417
Member Avatar for jabanista

I'm in the process of creating a program that would change a background color by pressing a button. Now, I already have everything set up. The background image is just an image of a rainbow, and when a button is clicked, it would change the whole background color. The thing …

Member Avatar for jabanista
0
1K
Member Avatar for davedrave

Hi, first time poster, and fairly new to java swing.Im trying to make a scrabble game and am stuck while trying to place a letter on the board, or even removing one for that matter. The playing board is just an array of JButtons all derived from a ScrabbleButton object, …

Member Avatar for Ezzaral
0
380
Member Avatar for minghia

I have a class which extends JDialog which by default has some text on it and a couple of buttons. Most of the instance of the buttons are "Ok" and "Cancel" so the two buttons have their bounds set. If I try to change the label on the Ok button …

Member Avatar for minghia
0
202
Member Avatar for btsuper

Hi everybody, I've been working with gui recently, and I need help with my JButtons. I need to figure out how to set a button on the keyboard to click that JBUtton. I.e. When i hit the enter key it picks say the third button on the list or something …

Member Avatar for btsuper
0
1K
Member Avatar for hauda67

Basically what I would to know is you have a button on one JPanel, and when the user clicks it, they are re-directed to the other JPanel. I would appreciate it if i could have some sort of hint or know about the overall structure of implementing this. Thanks,

Member Avatar for mangopearapples
0
123
Member Avatar for Avengerofsok

Hi, This is my first forum post and I'm very new to both the daniweb and programming community. I've been working on a project for a month or so and it involves clicking JButton to change the values of the text associated with the JButton clicked. Everything runs fine except …

Member Avatar for hanvyj
0
369

The End.