22 Topics

Member Avatar for
Member Avatar for CoilFyzx

Hello good day. I am having trouble letting my listeners wait on each other. I have a 1. JComboBox 2. JList - groups 3. JList - students The choice from the JComboBox, clears and updates the groups JList by way of an actionlistener. The ListSelectionListener for the groups JList, then …

Member Avatar for CoilFyzx
0
748
Member Avatar for chdboy

Is there any way that I don't use lots of IF statements?,right now it is according to Index of combo box items. else if(e.getSource().equals(jcb1)) { int selectedindex = jcb1.getSelectedIndex(); String comb_string = (String)jcb1.getSelectedItem(); if(selectedindex==1) { try { //String sql_command ="select * , count(*) over (partition by 1) total_rows from Employer …

Member Avatar for JamesCherrill
0
285
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
700
Member Avatar for thompsonSensibl

Hello, I'm in a pickle. (Please observe the code) In the actionPerformed method, I don't know how I can get the value of the variable 'minutes'. I can get 'hours' by e.getActionCommand(), but can't do minutes that way. I need to get both 'hours' and 'minutes' at the same action. …

Member Avatar for thompsonSensibl
0
237
Member Avatar for fmasroor

import java.awt.*; 02 import javax.swing.*; 03 import java.util.Random; 04 import java.awt.event.*; 05 import java.awt.Color; 06 import java.awt.Graphics; 07 public class actualstuff extends JFrame 08 { 09 private JTextField textField1; 10 public static int index=0; 11 public static Graphics gx; 12 public actualstuff() 13 { 14 Container container=getContentPane(); 15 container.setLayout(new FlowLayout()); …

Member Avatar for piyush09
0
171
Member Avatar for chudapati09

I created a JTree and also created a class which implements `TreeSelectionListener` then I pass that object into the JTree's function `addTreeSelectionListener`. In the [JavaDocs](http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TreeDemoProject/src/components/TreeDemo.java), there is an example where they implemented the function `public void valueChanged(TreeSelectionEvent e)` within the main class and passed `this` into `addTreeSelectionListener`. I tried to …

Member Avatar for JamesCherrill
0
177
Member Avatar for LFCFan_07

Hello, I need assistance with this java program I am writing, Im trying to make two buttons and when you click the button, it has a counter, and everytime you click it it prints a message saying I was clicked n times. This is what I have so far and …

Member Avatar for mKorbel
0
2K
Member Avatar for learntosucceed

I'm noob at GUI Swing. I have 2 questions. 1)I'm trying to implement a program that reads a text file, so I can use it to add multiple tabs to the program based on the amount of data in the text file. For example, text file have 3 names. I …

Member Avatar for nandosss
0
2K
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
189
Member Avatar for grako84

Hi folks! I'm trying to wire simple code and so far I'm stuck on ActionListener. My program should contain (JMenu) Menu called SELECT and two options InnerFrame 1 and InnerFrame 2. To debug it I've started using System.EXIT , unfortunately I cant compile my program, I'm receiving an error: "java:48: …

0
119
Member Avatar for javaNooblet

Hi All, I was having trouble with getting my program to display all the necessary conversions. Here is a snippet of the code to help explain what I want to do: [CODE] private class CalcListener implements ActionListener{ public void actionPerformed(ActionEvent e){ String centInput, inchInput, meterInput, yardInput; double cent, inch, meter, …

Member Avatar for NormR1
0
4K
Member Avatar for sathya88

am try to create notepad in java... menu item actionlisteners are not working...except exit... what is the problem with my code??? and is there any sequence follow... because am try to use jScrollpane the text area will be blocked??? code is.. [CODE]import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JFrame; import …

Member Avatar for JamesCherrill
0
223
Member Avatar for WolfShield

Okay, So this code I have is giving me an error: non-static variable this cannot be referenced from a static context. Here is the code: [code=java] package macey; /** * @author WolfShield */ import java.awt.*; import java.awt.event.*; import javax.swing.*; public class DemoConv implements ActionListener { private JLabel answerL; public static …

Member Avatar for WolfShield
0
154
Member Avatar for mhariharasudan

Hi all, I am new to java swing programming.I want to develop an application which has a panel with an array of grid points(not grid cells). The number of columns and rows of the grid points must be user specific. Once such an environment is created, the user's mouse click …

0
88
Member Avatar for bangor_boy

[CODE] private JButton[] buttons; private static final Character firstChar = 'A'; private static final Character lastChar = 'D'; /** Creates a new instance of ButtonPanel */ public ButtonPanel() { buttons = new JButton[4]; setLayout(new GridLayout(2,2)); Character label = firstChar; for (JButton b: buttons) { b = new JButton("" + label); …

Member Avatar for jon.kiparsky
0
165
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
Member Avatar for kezkez

I am having a hard time figuring out how to use the db object created in the first action event within the second action... how can i make the object visible there? i am trying to say add a record to db object by saying something like ... class Action2 …

Member Avatar for kezkez
0
156
Member Avatar for Dean_Grobler

Helooo, Attached is a pic of my main screen of my program. Basicly it's a phone book app similiar to one you'd have on your phone. The thing that I can't wrap my mind around, is that you see the nice big textArea there? After you've added a contact now. …

Member Avatar for masijade
0
169
Member Avatar for Dean_Grobler

Hi there, I just wanted to find out if one can have a actionListener() in one .class file and then have the actionEvent() in another .class file? If not, how would I go about to get the same effect? Thanks!

Member Avatar for Dean_Grobler
0
444
Member Avatar for zango

So my coding is a temperature converter. I have gotten everything down the way that it is wanted by the assignment except for one part. When I run the program, put in a value and select the radio button for conversion, no output ever shows up. Was hoping that someone …

Member Avatar for zango
0
730
Member Avatar for Ecliptical210

Hi guys, I'd really appreciate it if someone could look over my code and tell me why my JComboBox isn't working. I've got 3 Classes, 2 for the GUI, one for the standalone which the array is contained in. [CODE]import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JFrame; import javax.swing.JComponent; import javax.swing.SwingUtilities; import …

Member Avatar for javaAddict
0
152
Member Avatar for shashikant.v

public class OpenMenuListener implements ActionListener { public void actionPerformed(ActionEvent ev) { if(ev.getSource() == a) { f2 = new JFrame("shashikant verma"); p2 = new JPanel(); f2.getContentPane().add(p2); String str = "<html>"+"<h>"+"<P ALIGN = \"CENTER\">"+"<i>"+"<font size = \"10\">"+"<font color= \"#800080\">"+"CORRECT DEFINITION AND<br>"+"STRUCTURE OF FUNCTION y = f(x) "+"<br>"+"</i>"+"</h>"+"<P ALIGN = \"LEFT\">"+"<font size = …

Member Avatar for shashikant.v
0
211

The End.