interface updating problem


Hi all,

I am displaying image histograms on a user interface. Each histogram is represented by a class I wrote which extends JComponent. The painting is done the proper way through paintComponent and repaint() and it works great.

In my GUI constructor, I display the histograms..

pane7.add(graphs[0]); pane7.add(graphs[1]); pane7.add(graphs[2]);
Posted On: Wednesday 17th of October 2012 06:41:54 AM Total Views:  229
View Complete with Replies

RELATED TOPICS OF Swing / AWT / SWT PROGRAMMING LANGUAGE




Update MySQL table by updating JTable's cell

I have a JTable which is used to show and modify table from a MySQL database. I have no problem to retrieve/show data in JTable or insert new data into a blank table. However, I have problem to update any particular cell in the JTable and reflect the changes in the MySQL database. If there are hundreds of rows and I update couple cells within around 10 rows, and I create a save button to apply all the changes to MySQL's table. what's the proper way to do that It will include so many UPDATE statement for every row I changed, how do I detect any change I made in cells efficiently and save all the change back to the DB at once.
VIEWS ON THIS POST

212

Posted on:

Saturday 22nd September 2012
View Replies!

Problems updating JTextField in a new thread

I know others have posted about this, but I am still not understanding how this is supposed to work. My thought was to have a LogHandler class to which I would pass a JTextField. Then anywhere I felt the need to pass the status of my operations, I could just update the text. The problem is that I don't see any of the intermediate messages. I have been trying to get JTextField updating in a separate thread, but with no luck. The println shows messages scrolling in the text window, but I don't see them in the text field, just the last one, so I assume they are still all updating at once when the event queue empties. I left my various failed attempts commented in the code. Could someone help me understand what I am doing wrong import java.io.*; import java.nio.*; import java.util.*; import java.awt.*; import javax.swing.*; // // Set up a place to for all methods to call for logging results either to // the field in the main dialog or to a file. public final class LogHandler { // // Only one location for the log messages to go. // private static JTextField logField = null; // private static String logString = null; private static UpdateText runUpdate; private static Thread updateThread; public static boolean setLogField( JTextField tf ) { if (logField == null) { System.out.println("Assigning Log Field..."); logField = tf; runUpdate = new UpdateText( logField ); // updateThread = new Thread( runUpdate ); // updateThread.start(); } return true; } public static void writeLogField( final String logString ) { if (logField != null) { System.out.println("Writing: " + logString); // logField.setText( logString ); runUpdate.setText( logString ); // updateThread = new Thread( runUpdate ); // updateThread.start(); // SwingUtilities.invokeLater( runUpdate ); SwingUtilities.invokeLater( new Runnable() { public void run() { logField.setText( logString ); } }); } } public static void clearLogField() { if (logField != null) { logField.setText(""); } } static class UpdateText implements Runnable { JTextField field; String text; public UpdateText( JTextField field ) { this.field = field; } public void setText( String text ) { this.text = text; } @Override public void run() { field.setText( text ); } } }
VIEWS ON THIS POST

127

Posted on:

Saturday 22nd September 2012
View Replies!

jcombobox is not auto updating with database.

hello all, i have a problem, actually i have posted this problem earlier, and michael dunn helps me solve that problem. Below is the problem. http://www.coderanch.com/t/579226/GUI/java/auto-update-jcombobox but now i m getting the same problem in auto updating jcomboboxes. i have two code one is updating jcombobox with arraylist, and working properly. one is with db that is not working. code for both are same, instead of arraylist i am just using database. i also have done debugging by putting bunch system.out.println to check the flow, both giving the same sequence of statements, i mean flow of both are same. i don't know what wrong is going there, can anyone please help me in that. below is the code with db which is not working. import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; import java.sql.*; class Display { CardLayout cl = new CardLayout(); JPanel cardPanel = new JPanel(cl); JPanel panel = new JPanel(); JTextField tf = new JTextField(15); ArrayList resultSetList = new ArrayList(); JButton btn = new JButton("Add Student"); JFrame frame = new JFrame(); JComboBox studentNames = new JComboBox(); DefaultComboBoxModel dcm = new DefaultComboBoxModel(); LoadStudents ls = new LoadStudents(); SaveStudent ss = new SaveStudent(); Display1 d1 = new Display1(); public Display() throws SQLException { System.out.println("Inside WithArrayList Constructor"); cardPanel.add(panel,"display"); cardPanel.add(d1.panel1,"display1"); panel.add(tf); panel.add(btn); frame.add(cardPanel); frame.setVisible(true); frame.setSize(200,100); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try{ System.out.println("Inside WithArrayList ActionListener"); String values = tf.getText(); ss.saveStudent(values); System.out.println("Inside WithArrayList ActionListener after savestudent"); tf.setText(""); System.out.println("Inside WithArrayList ActionListener Before d1.update"); d1.update(); System.out.println("Inside WithArrayList ActionListener After d1.update"); cl.show(cardPanel,"display1"); }catch(Exception e){} } }); } public static void main(String args[]) throws SQLException{new Display();} class Display1 { JPanel panel1 = new JPanel(); JComboBox studentNames = new JComboBox(); DefaultComboBoxModel dcm = new DefaultComboBoxModel(); LoadStudents ls = new LoadStudents(); SaveStudent ss = new SaveStudent(); public Display1() throws SQLException { System.out.println("Inside Constructor Display1"); ls.loadStudents1(studentNames); System.out.println("Inside Constructor Display1 After Calling ls.loadStudents1"); panel1.add(studentNames); } public void update() throws SQLException { System.out.println("Inside Update method of Display1 class"); ls.loadStudents1(studentNames); System.out.println("Inside Update method of Display1 class After Calling loadstudents1"); } } class LoadStudents { DefaultComboBoxModel model; public void loadStudents1(JComboBox cbo) throws SQLException { System.out.println("Inside loadStudents1 of class LoadStudents Beginning"); ArrayList ress; Db db = new Db(); model = new DefaultComboBoxModel(); ress = db.NameValues(); ListIterator iter = ress.listIterator(); while (iter.hasNext()) { model.addElement(iter.next()); } cbo.setModel(model); System.out.println("Inside loadStudents1 of class LoadStudents End"); } } class SaveStudent { public void saveStudent(String values) throws SQLException { System.out.println("Inside saveStudent of class saveStudent Beginning"); Db db = new Db(); db.Insert1(values); System.out.println("Inside saveStudent of class saveStudent End"); } } class Db { public ArrayList NameValues()throws SQLException{ System.out.println("Inside NameValues of class Db Beginning"); Statement ps; ResultSet res; String query = "SELECT names FROM studentregistration"; DbConnection dbconn = new DbConnection(); Connection conn = dbconn.dbConn(); ps = conn.createStatement(); res = ps.executeQuery(query); while(res.next()){ resultSetList.add(res.getString("names")); } return resultSetList; } public void Insert1(String nm) { try{ PreparedStatement st; String query = "INSERT into studentregistration (names) VALUES ()"; DbConnection dbconn = new DbConnection(); Connection conn = dbconn.dbConn(); st = conn.prepareStatement(query); st.setString(1,nm); int rr = st.executeUpdate(); System.out.println("Inside Insert1 of class Db Beginning"); }catch(Exception e){e.printStackTrace();} } } }
VIEWS ON THIS POST

203

Posted on:

Monday 24th September 2012
View Replies!

Jtextfield is not updating dynamically(at run time)

Hi all, I am trying to update jtextfield at runtime with new values, which are fetched from a hashmap. But the jtextfield text is not updating. Please refer to the below code. Please suggest, where i am going wrong.
VIEWS ON THIS POST

144

Posted on:

Tuesday 25th September 2012
View Replies!

How to implement getColumnClass in interface TableModel

I'm trying to create an implementation of javax.swing.table.TableModel. I have a good idea of how to do most of the implementation, but I don't know how to implement the getColumnClass method.
VIEWS ON THIS POST

111

Posted on:

Tuesday 25th September 2012
View Replies!

JList model elements pre exist, updating of vector does not change model

so a few entries already exist in the jList. however, once the vector "caller" gets updated the values are not updated in the jList. Please help! thanks! public void split1(Vector v1) { this.caller = v1; left = new JPanel(); left.setLayout(new BorderLayout()); DefaultListModel model = new DefaultListModel(); customerList = new JList(model); scroll = new JScrollPane(customerList); scroll.setPreferredSize(new Dimension(150, 500)); left.add(scroll); String[] entries = {"one", "two", "three"}; for (int i = 0; i < entries.length; i++) { model.addElement(entries[i]); } if (caller != null) { String hell = caller.get(0) + " " + caller.get(1); validate(); int index = customerList.getSelectedIndex(); // get selected index if (index == -1) { // no selection, so insert at beginning index = 0; } else { // add after the selected item index++; } model.addElement(hell); customerList.setSelectedIndex(index); customerList.ensureIndexIsVisible(index); customerList.repaint(); scroll.revalidate(); scroll.repaint(); } }
VIEWS ON THIS POST

142

Posted on:

Wednesday 26th September 2012
View Replies!

problem with jcombobox

hey you all, i have combobox with big list and when i drag the list back and forth the list get messed up. what i have to do in order to avoid this
VIEWS ON THIS POST

153

Posted on:

Tuesday 16th October 2012
View Replies!

button problem

hi, help me with this code.... import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; public class EventDemo implements ActionListener{ JButton b1; void go(){ JFrame frame=new JFrame("my first applet"); b1=new JButton("my buttton"); b1.setName("click"); b1.setText("click me"); b1.addActionListener(this); frame.add(b1); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200); frame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { b1.setText("you clicked me"); } public static void main(String[] args) { EventDemo test=new EventDemo(); test.go(); } }
VIEWS ON THIS POST

126

Posted on:

Wednesday 17th October 2012
View Replies!

Modal dialog problem with JApplet

Hi , When i make a JDialog modal, it only gets modal with respect to my JApplet only, but i want to make it modal with respect to browser. like the usual modal dialogs which can be made using javascript. Is there any way to make a JDialog modal with respect to browser. Any hints or answer would help me a lot.
VIEWS ON THIS POST

176

Posted on:

Wednesday 17th October 2012
View Replies!

Problem updating a JTable in a tab before the tab is opened

I change the contents of a JTable when running code from a user's action in the currently opened tab (I am using Java 1.6). To update the contents I change the data in my TableModel class that extends DefaultTableModel so that the methods getRowCount, getColCount and getValueAt return the correct values. However, when I go to the tab that contains the table it is not displaying the updated contents. I have tried using invalidate and repaint to no avail; I don't know what happens when the RepaintManager queues the requests (I think it is used for managing components currently in view). However, if I close and restart the program the updated data (which comes from a database) is displayed correctly. I want to invoke repaint immediately after the table is displayed on opening the tab; the question is what kind of event can I use to do this
VIEWS ON THIS POST

60

Posted on:

Wednesday 17th October 2012
View Replies!

problem in attached file .

Help me out in solving 1 error in my code: /* please run this code and try to sort out the error.*/ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.*; import java.util.Enumeration; import java.util.zip.*; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class Zip extends JPanel implements ActionListener { JButton button1, button2, button3; JFileChooser chooser; String choosertitle; JTextField field1, field2; //private int BUFFER; static final int BUFFER = 2048; public Zip() { this.setLayout(null); button1 = new JButton("Browse"); button2 = new JButton("Browse"); button3 = new JButton("Zip"); field1 = new JTextField(); field2 = new JTextField(); field1.setBounds(30, 50, 200, 25); button1.setBounds(240, 50, 100, 25); this.add(field1); this.add(button1); field2.setBounds(30, 150, 200, 25); button2.setBounds(240, 150, 100, 25); this.add(field2); this.add(button2); button1.addActionListener(this); add(button1); button2.addActionListener(this); add(button2); button3.setBounds(30, 200, 90, 25); this.add(button3); button3.addActionListener(this); add(button3); button1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button1actionPerformed(e); } }); button2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button2ActionPerformed(e); } }); button3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { button3ActionPerformed(e); } }); } public void unzip(String argv){ try { BufferedOutputStream dest = null; BufferedInputStream is = null; ZipEntry entry; ZipFile zipfile = new ZipFile(argv); Enumeration e = zipfile.entries(); while(e.hasMoreElements()) { entry = (ZipEntry) e.nextElement(); System.out.println("Extracting: " +entry); is = new BufferedInputStream (zipfile.getInputStream(entry)); int count; byte data[] = new byte[BUFFER]; FileOutputStream fos = new FileOutputStream(entry.getName()); dest = new BufferedOutputStream(fos, BUFFER); while ((count = is.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count); } dest.flush(); dest.close(); is.close(); } } catch(Exception e) { e.printStackTrace(); } } public void button2ActionPerformed(java.awt.event.ActionEvent e) { int result; /* Chooser frame=new Chooser(); field2.setText(frame.fileName1);*/ chooser = new JFileChooser(); //chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle(choosertitle); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // // disable the " files" option. // chooser.setAcceptFileFilterUsed(false); // if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory()); System.out.println("getSelectedFile() : " + chooser.getSelectedFile()); field2.setText(chooser.getSelectedFile().toString()); } else { System.out.println("No Selection "); } } public void button1actionPerformed(java.awt.event.ActionEvent e) { int result; /* Chooser frame=new Chooser(); field2.setText(frame.fileName1);*/ chooser = new JFileChooser(); //chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle(choosertitle); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // // disable the " files" option. // chooser.setAcceptFileFilterUsed(false); // if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory()); System.out.println("getSelectedFile() : " + chooser.getSelectedFile()); field1.setText(chooser.getSelectedFile().toString()); } else { System.out.println("No Selection "); } } public void button3ActionPerformed(java.awt.event.ActionEvent evt) { this.zip (field1.getText()) ; } /* private void zip(String argv[]) { try { BufferedInputStream origin = null; FileOutputStream dest = new FileOutputStream("c.zip"); ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest)); //out.setMethod(ZipOutputStream.DEFLATED); byte data[] = new byte[BUFFER]; // get a list of files from current directory File f = new File("."); String files[] = f.list(); for (int i=0; i
VIEWS ON THIS POST

209

Posted on:

Wednesday 17th October 2012
View Replies!

getting a problem ,can't see the button

hi , i was testing out card layout. What i want in my application is three panels At first i want the frame to be Divided into two panels and then add buttons on it . This is where the problem is coming. The button is not visible on the panel . It is visible when i remove the second panel . Another question is that can i control the size of the button on it here's the full code : import java.awt.event.*; import java.awt.*; public class CardLayoutEg extends Frame { public static void main(String... args) { CardLayoutEg cd=new CardLayoutEg(); cd.setVisible(true); } private Panel p1,first,second,third; Button b1; CardLayoutEg() { setSize(700,800); p1=new Panel(); Checkbox c1=new Checkbox("wierd"); b1=new Button("next"); b1.setBounds(40,50,200,100); p1=new Panel(); p1.setLayout(null); first=new Panel(); second=new Panel(); third=new Panel(); first.add(c1); first.add(b1); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CardLayout c=(CardLayout)p1.getLayout(); c.next(p1); } }); p1.setSize(700,600); third.setSize(700,200); p1.setLayout(new CardLayout()); p1.add(first,"1"); p1.add(second,"2"); first.setBackground(Color.green); second.setBackground(Color.red); add(p1); add(third); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } }
VIEWS ON THIS POST

201

Posted on:

Wednesday 17th October 2012
View Replies!

Scroll panel problems

I am having alot of problems getting this scroll panel to work. Specifically I have the [panel on my GUI, but I cant figure out how to get the text area to populate it. Can someone please tell me what I a,m doing wrong here. These are the code portions that pertain to the scroll panel only. private JTextArea jtextarea1;//define textarea private JScrollPane scrollpane1;
VIEWS ON THIS POST

224

Posted on:

Wednesday 17th October 2012
View Replies!

Exception when updating JList within thread

I'm working on a university assignment in distributed systems where we have to a implement a client software. I have implemented a GUI in Swing which features a JList component showing the currently logged in users. I thought it would be a good idea to have a thread update the list every second as new users log on and other users log off. The method the thread calls looks like this: private void updateOnlineUsersPanel() { Set newUsers = null; try { newUsers = location_.getOnlineUsers(); } catch(java.rmi.RemoteException e) { System.err.println("Remote Exception: " + e.toString()); } if(newUsers != null && !newUsers.equals(oldUsers)) { oldUsers = newUsers; String selected = (String)gui_.getOnlineUserList().getSelectedValue(); gui_.onlineUsersModel.removeElements(); for(String user : oldUsers) { gui_.onlineUsersModel.addElement(user); } gui_.getOnlineUserList().setSelectedValue(selected, true); gui_.getOnlineUserList().updateUI(); } }
VIEWS ON THIS POST

121

Posted on:

Wednesday 17th October 2012
View Replies!

if statement problem

I am new to Java Scripting and I am trying to write some code or if statement for the following. I have 2 JButtons (one labeled btnAddTwo and one lableled btnSubOne) and one text field.I am trying to get the btnAddTwo to add 2 when I click it and the btnSubOne to subtract one from the total in the text field. I built my program in netbean as a gui frame. Everthing works except for my counting.
VIEWS ON THIS POST

207

Posted on:

Wednesday 17th October 2012
View Replies!

Printing invicible JTable with Column removed - JTable.PrintMode.FIT_WIDTH problem

My JTable is a table with some columns including a checkbox column. When the user clicks on the print button, the program will create an invisible copy of the visible table, then add a rowsorter to exclude all the rows with a checkbox that is set to false. then remove the checkbox column from the table. For the table to print I manually change the size of the table (else the content will not print). That is how I set up the table, I hope it made sense. But it is when I set the table to print with JTable.PrintMode.FIT_WIDTH thats not working as it should. The table is not printed across the whole page, like it still believes that the removed column is still there, resulting in that the rigthmost column will be cut, and not all data will be printed. I don't have this problem when printing JTable.PrintMode.NORMAL. I hope my explanation made sense. I have tried a long time to fix this but without result. I'd be gratefull if someone could help me. Here is the code. edit: I have removed the code till someone who knows tells me it is okay (see the two posts below).
VIEWS ON THIS POST

201

Posted on:

Wednesday 17th October 2012
View Replies!

Tricky JTextArea problem

I have a JTextArea (or more than one) inside a JScrollPane The JScrollPane, has VERTICAL_SCROLLING_AS_NEEDED, no horizontal scrolling. When the frame is resized the scrollpane resizes accordingly. My problem is: Suppose I have 1000 words of text to put into the JTextArea. If I squash the frame horizontally, the words wrap around which is fine, and vertically, the scrollbar kicks in. But I just want to display 3 lines of text, and always finish with three dots ... when there is more text, but no room for it. I used setPreferredSize on the JTextArea which makes sure I get three lines worth. But when I select the text, the left over text is still hidden below the 3 lines. I don't want to display this text, just use 3 dots... Can anyone help
VIEWS ON THIS POST

221

Posted on:

Wednesday 17th October 2012
View Replies!

thread problem

In a swing application, when ok button is clicked, i want to new a class ScanCard (implements ScannerListener and PropertyChangeListener), and I want to wait till ScanCard is finished then doAction(), if like the code showed, the doAction() is performed before or during ScanCard runing, what should I do to achieve the purpose this.okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent aEvt){ if (btnGroup.getSelection() == null) doSomething; else { dispose(); try { ScanCard scanCard = new ScanCard(); if (true) doAction(); }catch() {} } } });
VIEWS ON THIS POST

267

Posted on:

Wednesday 17th October 2012
View Replies!

combobox is not updating in Swing GUI

I am adding item in the combo box within a fucntion and I am calling that function from actionListener of a button. The combo box is getting populated, I am able to print the value using SOP but it is not updating in GUI. PSB the sample code : // Leeloo.java import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Leeloo extends JPanel implements ActionListener { String login_s; String passwd_s; JComboBox env_combo; JComboBox app_combo; JComboBox logs_combo; // check it without static JButton logs; String [] env_log = {"none"}; //Leeloo l = new Leeloo(); public Leeloo() { new FlowLayout(); String[] env = {"65","66","79","80","81","82","83","84","85"}; String[] app = {"ABP","CRM","OMS","ARM","SOM","USM"}; env_combo = new JComboBox(env); app_combo = new JComboBox(app); logs_combo = new JComboBox(env_log); logs = new JButton("Logs"); add(env_combo); add(app_combo); add(logs_combo); add(logs); logs.addActionListener(this); } public void actionPerformed(ActionEvent e) { //JComboBox cb = (JComboBox)e.getSource(); //String host = "ilhp010"; System.out.println("hiya"); String s = (String)env_combo.getSelectedItem(); String p = (String)app_combo.getSelectedItem(); Leeloo l = new Leeloo(); l.getDataFiles( "****", "****","****", "my/logs", "C:\ftp", start,end ); System.out.println("hiya back"); //String password = "Unix11!"; } public static void CreateAndShowGUI() { JFrame jfrm = new JFrame("Logs"); //jfrm.setSize(190,70); jfrm.setSize(400,400); jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent newContentPane = new Leeloo(); newContentPane.setOpaque(true); jfrm.setContentPane(newContentPane); //jfrm.pack(); jfrm.setVisible(true); } public static void main(String args[]) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { CreateAndShowGUI(); } }); } public void getDataFiles( String server, String username, String password, String folder, String destinationFolder, Calendar start, Calendar end ) { try { // adding items to combo box but they are not updating String[] fileNames = {"f1","f2","f3"}; logs_combo.addItem("added"); //logs_combo.removeItemAt(0); for(int i=0;i
VIEWS ON THIS POST

65

Posted on:

Wednesday 17th October 2012
View Replies!

problem drawOval() cant be found.

I am trying out this tutorial to get this drawOval() to work but the compiler tells me that the drawOval cant be found. I triple checked that my initialization is in place, and I have imported the proper library to get it to work. So I am at a loss here. my code: import java.awt.*; import java.awt.Graphics; import javax.swing.*; import javax.swing.event.*; public class Oval_Sub extends JFrame { private JSlider slider; private drawOval myPanel; public void Oval_Sub() { super("the title"); myPanel = new drawOval(); myPanel.setBackGroundColor(Color.ORANGE); // SwingConstants.HORIZONTAL sets the slider to move left to right or vise versa // 0, 200 sets the min and max value the slider has on the appropriate ends slider = new JSlider(SwingConstants.HORIZONTAL, 0, 200, 10); // sets the ticks or hash marks on the slider to determine intervals in values // the argument 10 refers to setting a tick every 10 pixels slider.setMajorTickSpacing(10); slider.setPaintTicks(true); slider.addChangeListener( new ChangeListener() { public void StateChanged(ChangeEvent e) { // setD() comes from Oval.java // get the value from slider and pass it to setD() myPanel.setD(slider.getValue()); } } // end ChangeListener() ); // end addChangeListener(); add(slider, BorderLayout.SOUTH); add(myPanel, BorderLayout.CENTER); } }
VIEWS ON THIS POST

241

Posted on:

Wednesday 17th October 2012
View Replies!