GUI Fluctuation problem in swing




I have a dialogue in which i am entering values. After submit I am checking for duplicate values in database and if exist I am again creating the same dialogue. As it can happen many times. I want to continue with that code. So I have used while loop and I am checking the flag value which I get after calling action_insertok()

See the code

while (!result) { result=true; DialogFactory.showDialog(null, "Add Assessment Type", assessDialogPage, new ACTION_InsertOk(), true, true); }
Posted On: Wednesday 17th of October 2012 09:16:34 PM Total Views:  251
View Complete with Replies

RELATED TOPICS OF Swing / AWT / SWT PROGRAMMING LANGUAGE




Netbeans gui plugin generates main method for all gui classes

/** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ // /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } // /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); }
VIEWS ON THIS POST

189

Posted on:

Wednesday 19th September 2012
View Replies!

issue in a gui

i got a gui were you can search for people in a txt file and wen it finds a match it prints the match in a jtextArea. whit the following code i enter an ID in a textfied and wen i press a button called Search it print me the ID, but i want also to print me the 2 elements before the ID too. oh i forgot i pass my txt into an arraylist . that ny isuue private void SearchActionPerformed(java.awt.event.ActionEvent evt) { Scanner s; try { s = new Scanner(new File("C:\\Grupo.txt")); ArrayList list = new ArrayList(); while (s.hasNext()) { list.add(s.next()); } s.close(); for (Object ss : list) { if (ss.equals(jTextField4.getText())) { jTextArea1.append(jTextField4.getText() ); }}
VIEWS ON THIS POST

160

Posted on:

Wednesday 19th September 2012
View Replies!

best way to display reports in netbeans gui

0 down vote favorite i have menu item (NetBeans) that when pressed needs to generate a report on a linux machine. Do you have any idea on what would be th ebest way to display the form should i Use iReport and Jasper Reports Display the information in some sort of jdialogue form that pops up once the menu item is selected. The way i produce the report might be insufficient. I use a c-shell script to read the call a sql script to read the information from the database and then dump it into a txt file. I want to read this text file and produce an offical report either using ireport or on a jdialue form. From reviewing ireport it seems like i dont have to use this method. I can run the sql script directly from ireport and generate the rpeort problem is i am on a linux machine and im not sure ireports will work well plus this will be a long term effort to build a desktop gui and im wondering if this is the right apporach . Does iReport have reliable support and will it work with the latest netbeans releasde anyone with experience may answer
VIEWS ON THIS POST

188

Posted on:

Saturday 22nd September 2012
View Replies!

Some advice and guidance required

, I'm considering a port of my complete IDE framework from C# to Java. I'm a Java newbie, so it may not be an easy task for me, but the first real problem I'm having is that currently I'm using a couple of third party components in my framework and I would need a replacement for them on Java (Swing I supose is the way to go). The first component I would need to find is a complete docking framework that allows my IDEs to have dockable and floatable panels, something similar to what you can see on Visual Studio or even Eclipse. I'm looking for stable components, I don't care paying something for them if it is not too much (I'm not a companie, just a single indie developer). The one I'm currently using is this one: http://www.divelements.co.uk/net/controls/sanddock/screenshots.aspx (some screnshots) The second component I'm looking for is a source code editor component that allows the definition of custom programming languages and allows syntax highlighting, folding and intellisense-like prompts and function-parameter tips to be displayed. This is the component I'm currently using: http://www.qwhale.net/products/editor.htm Wich is a great tool and has a very nice framework to create your own parsers and lexers and abstract syntax trees, etc. If anyone can point me in the right direction... I can't use GPL licensed components, as I'm developing non open source software. LGPL is ok.
VIEWS ON THIS POST

123

Posted on:

Monday 24th September 2012
View Replies!

textfields are squished in gui

, I need a little help with a JDialog box I'm working on. In my init() method I load up all the components for the JDialog. The labels show just fine, but the JTextFields and JTextArea are all squished. I've set the setPreferredSize(...) method on each text component but it doesn't seem to make any difference when the whole thing renders. I need another pair of eyes to show me where I went wrong. Can you tell from my code what's wrong Alan public void init() { try{ this.setSize(new Dimension(400, 400)); path = MainGUI.appPath + File.separator + "pns.properties"; contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); this.setIconImage(MainGUI.magnifier.getImage()); emailPanel = new JPanel(); emailPanel.setLayout(gridBagLayout1); lblTo = new JLabel(MainGUI.messages.getString("lblTo")); txtTo = new JTextField(); txtTo.setPreferredSize(new Dimension(180, 27)); lblFrom = new JLabel(MainGUI.messages.getString("lblFrom")); txtFrom = new JTextField(); txtFrom.setPreferredSize(new Dimension(180, 27)); lblCopy = new JLabel(MainGUI.messages.getString("lblCopy")); txtCopy = new JTextField(); txtCopy.setPreferredSize(new Dimension(180, 27)); lblSubject = new JLabel(MainGUI.messages.getString("lblSubject")); txtSubject = new JTextField(); txtSubject.setPreferredSize(new Dimension(180, 27)); lblComments = new JLabel(MainGUI.messages.getString("lblComments")); txtComments.setPreferredSize(new Dimension(400,300)); txtComments.setWrapStyleWord(true); scrollpane = new JScrollPane(txtComments); scrollpane.setPreferredSize(new Dimension(300, 300)); emailPanel.add(lblTo, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(txtTo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(lblFrom, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(txtFrom, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(lblCopy, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(txtCopy, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(lblSubject, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(txtSubject, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(lblComments, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0 ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); emailPanel.add(scrollpane, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0 ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); btnPanel = new JPanel(); btnSend = new JButton(); btnSend.addActionListener(this); btnClose = new JButton(); btnClose.addActionListener(this); btnSend.setText(MainGUI.messages.getString("btnSend")); btnClose.setText(MainGUI.messages.getString("btnClose")); btnPanel.add(btnSend); btnPanel.add(btnClose); contentPane.add(emailPanel, BorderLayout.CENTER); contentPane.add(btnPanel, BorderLayout.SOUTH); ... this.setVisible(true); } catch(IOException ioe) { ErrorLogger.log(Level.SEVERE, this.getClass().getName(), "init", "Caught Exception", ioe); } catch(java.util.MissingResourceException mre) { ErrorLogger.log(Level.SEVERE, this.getClass().getName(), "init", "Caught Exception", mre); JOptionPane.showMessageDialog(this, MainGUI.messages.getString("missingResourseExceptionMessage") + mre.getMessage()); } catch(Exception e) { ErrorLogger.log(Level.SEVERE, this.getClass().getName(), "init", "Caught Exception", e); } }
VIEWS ON THIS POST

181

Posted on:

Tuesday 25th September 2012
View Replies!

A doubt in setVisible() in gui

I have a simple doubt...i created a GUI application in java, a complex one with NetBeans IDE..and is running perfectly without any problems...here i used the setVisible method a number of times for the components like JList, JLayeredPane etc... can there be any problem in future in my application because of this setVisible method...if so is there any solution for that.... any help will be appreciated..
VIEWS ON THIS POST

128

Posted on:

Tuesday 2nd 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

156

Posted on:

Wednesday 17th October 2012
View Replies!

"way to go" for java desktop gui development

hi, i have a general question about java (desktop) user interfaces i have developed several desktop applications, some with pure swing, some using Spring-RCP. Recently i also started developing web applications (i started with wicket and tapestry and ended up using JSF2+Primefaces). The more time i spend web-developing the more i realize how complicated developing "regular" desktop applications really is in comparison. there are 2 things which are really important to me a) i need a simple way to build a "form" like this: ... (if i klick this the validation messages are displayed where the error occurs!) well, i guess i could build this using borderlayout without any problems, so the real problem is probably a combination with b) b) JSR303 support so i can use my JPA2 bean validation. Maybe i could call the validate() function of the Validator myself, but i am not satisfied with that solution. the problem is that i need some sort of connection between the validated bean property and the validationmessage-label. Example: I have a Class "Hotel" with the fields "address" and "numberOfRooms". The user accidently enters a letter instread of a number in "numberOfRooms" and klicks on save. The Validation fails and what i need is a way to find out which validationMessage i have to set. Maybe i could use a HashMap, but isn't there a better way than doing this manually c) a way to "bind" fields of a POJO to a textfield, so i don't have to store the values of every textfield manually into the field. this works in nearly every webframework, how do i do this in Java Desktop without writing hundrets of code-lines I used Spring-RCP but the project seems to be as good as dead, and the load-time increasing makes me think there is a big overhead. So my question is: what's the "way to go" for java desktop applications JavaFx2 Swing Spring-RCP What would you recommend me What's the best/simplest way to use JSR303 and "in-line-validation" like explained above Did i miss a train here
VIEWS ON THIS POST

72

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

184

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

185

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

196

Posted on:

Wednesday 17th October 2012
View Replies!

how to transfer contol to another gui

am developing a gui based application.my problem is that i want to see a second gui form i created when i click on the continue button on my first form....here is a portion of my code......please i need your help,what should i do in my logic THANKS //FORM1 CODE private class ButtonHandler implements ActionListener,Serializable { public void actionPerformed(ActionEvent e) { Form1 form1 = new Form1(); String x = ""; File file = new File("client.txt"); /** try { RandomAccessFile Rfile = new RandomAccessFile("client.txt","rw"); long n = 10; Rfile.seek(n); } catch(FileNotFoundException j){}catch(IOException nb){} */ try { FormLogic logic = new FormLogic(); PrintWriter out = new PrintWriter(new FileWriter(file)); logic.setName(nameText.getText()); String schooldata = (String) boxForSchoolsComboBox.getSelectedItem(); String graduatedata = (String)graduateDegreeProgramComboBox.getSelectedItem(); String statedata = (String) stateComboBox.getSelectedItem(); String addressdata = addressText.getText(); String citydata = cityText.getText(); String statdata = statetext.getText(); String zipcodedata = zipcodeText.getText(); String countrycode = countryText.getText(); String countrycodedata = countrycodeText.getText(); String areacodedata = areacodeText.getText(); String phonenodata = phonenumberText.getText(); String emaildata = emailaddressText.getText(); String datebatedata = dateofbirthText.getText(); String citizendata =(String) citizenstatusComboBox.getSelectedItem(); boolean radiodata = maleButton.isSelected(); out.println(schooldata); out.println(graduatedata); out.println(logic.getName()); out.println(addressdata); out.println(citydata); out.println(statdata); out.println(zipcodedata); out.println(countrycode); out.println(countrycodedata); out.println(areacodedata); out.println(phonenodata); out.println(emaildata); out.println(datebatedata); if(radiodata == true) { out.println("MALE"); } else {out.println("FEMALE");} out.close(); /** RandomAccessFile Rfile = new RandomAccessFile("client.txt","rws"); long n =30; n++; Rfile.seek(file.length()); Rfile.seek(n); Rfile.writeBytes(addressdata); long m =20; m++; Rfile.seek(file.lastModified()); Rfile.seek(file.length()); Rfile.writeBytes(citydata); Rfile.seek(file.length()); Rfile.close(); */ }catch (IOException e1){ System.out.print("error opening file"); } //this.launch(); } //FORM2 CODE.... public class Form1 extends JFrame implements ActionListener { public void actionPerformed(ActionEvent ae){} /** Creates a new instance of Form1 */ private JLabel qualificationFormLabel,schoolLabel; private JLabel graduationdegreeLabel,universityLabel; private JComboBox graduateDegreeProgramComboBox,boxForSchoolsComboBox; private JLabel gradeLabel,grescoreLabel; private JTextField gradeText,universityText; private JLabel testdateLabel,scoreLabel,toeflscoreLabel,detailsLabel; private JTextField testdateText,scoreText; private JButton submitButton; private JPanel qualificationFormPanel; private JPanel graduateDegreeProgramPanel,schoolPanel; private JPanel gradePanel; private JPanel graduategradePanel; private JPanel grePanel,testPanel,toeflPanel,detailsPanel,submitPanel; private JPanel generalPanel; private Font font, fontGDP; private String graduateDegreePrograms[] = {"Aeronautics-Astonautics", "Earth Science","Applied Physics ", "Biochemistry", "Education", "Biosciences", "Humanities and Sciences", "Engineering and Applied Sciences", "Architecture", "Law", "Nursing", "Journalism"}; private String school[] = {"Engineering", "Medicine","Law", "Social Sciences", "Humanities", "Education","Sciences"}; public Form1() { //Set the title of the frame. super.setTitle("QUALIFICATION DETAILS....."); font = new Font("Roman", Font.BOLD, 15); fontGDP = new Font("Tahoma", Font.PLAIN,12); //Initializing the qualificationFormLabel qualificationFormLabel = new JLabel("QUALIFICATION DETAILS"); qualificationFormLabel.setFont(font); qualificationFormLabel.setForeground(Color.black); qualificationFormLabel.setVisible(true); //Initializing the qualificationFormPanel qualificationFormPanel = new JPanel(); qualificationFormPanel.add(qualificationFormLabel); qualificationFormPanel.setVisible(true); //Initializing the graduationdegreeLabel graduationdegreeLabel = new JLabel("GRADUATION DEGREE" + " PROGRAM:"); graduationdegreeLabel.setFont(fontGDP); graduationdegreeLabel.setForeground(Color.black); graduationdegreeLabel.setVisible(true); //Initializing the graduateDegreeProgramComboBox graduateDegreeProgramComboBox = new JComboBox(); for(int count1 = 0; count1
VIEWS ON THIS POST

76

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

181

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

179

Posted on:

Wednesday 17th October 2012
View Replies!

custom shaped gui components?

how to create custom shaped gui components . . . please specify some clue . . .
VIEWS ON THIS POST

73

Posted on:

Wednesday 17th October 2012
View Replies!

creating a custom command prompt with java gui

hi there. im just wondering if this is possible. like creating your own cmd for configuration for my app. Procedures create a frame with a textarea on it. put the output stream to the text area text area accepts input but the prompt couldn't be deleted. \tC:\> \t\t \t\t\t\t\t\t cls (undeletable) (deleteable) works really just like the CMD. is it possible to make it with java gui
VIEWS ON THIS POST

70

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

199

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

239

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

213

Posted on:

Wednesday 17th October 2012
View Replies!

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]);
VIEWS ON THIS POST

199

Posted on:

Wednesday 17th October 2012
View Replies!