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); } }
Posted On: Wednesday 17th of October 2012 06:39:50 AM Total Views:  241
View Complete with Replies

RELATED TOPICS OF Swing / AWT / SWT PROGRAMMING LANGUAGE




problem in JSplitPane

not able to add into JSplitPane.. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.JTextArea; public class Ctank { static String sometext = "This is a simple text to test....."; public static void main(String args[]) { JFrame frame = new JFrame(); frame.setVisible(true); frame.setSize(800,600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTextArea jt1 = new JTextArea(sometext); Cpoint point = new Cpoint(); JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, point, jt1); frame.getContentPane().add(sp, BorderLayout.CENTER); } } i m not able to add components to JSplitPane, here i m trying to add simple a JTextField and one class CPoint (which exteding JPanel), but on the frame, when i m executing the code nothing is visible to me, what wrong i am doing\t
VIEWS ON THIS POST

187

Posted on:

Monday 1st October 2012
View Replies!

Really, really weird GUI problem

Hi Everybody!! I have a very weird problem with a Java GUI that I've built at work. It is so weird I don't even know where to start to look for help!! I hope this is the place; if not, I apologize. We have a standalone system at an offsite location consisting of a Windows PC, running XP, and a SuSE Linux machine. I built a Java GUI that runs some bash scripts on the Linux machine. The GUI is started from the Windows machine because the user is not a Linux person. The GUI was built to replace scripts that presented the user with command line prompts for providing inputs to the main processing scripts. The user clicks an icon on the windows desktop which runs a DOS batch (*.bat) file. The batch file uses plink, with a stored PuTTY session, to connect to the Linux machine and to execute a "java -jar XXX.jar" command to start the GUI. The GUI displays on the Windows PC due to Cygwin/X X Server running on the windows PC. Okay. Now for the weirdness. If I leave the GUI in the location where it initially pops up, everything is fine. If I move the GUI, then the pulldown menus (dropdown combo boxes and menubar pulldowns) no longer work properly. And ONLY the pulldown menus. Everything else works fine (pushbuttons, text fields, ...). If I move the GUI back to its original location, everything works fine. If I click, hold and drag the mouse cursor over to where the GUI initially popped up (leaving the GUI where I moved it) the pulldown menus work properly. At first I thought I had a problem with the way I initialized the pull down menus but I'm not so sure anymore. I'm wondering if there is something weird going on with the windows putty linux or the Xwin setups. Contributing to not being able to solve this is that I cannot replicate this behavior at work. Unfortunately we don't have an exact replica of the offsite system; I'm testing/building this GUI on a XP to Debian Linux machine. As anybody seen anything like this Any suggestion as to what might be going on here
VIEWS ON THIS POST

167

Posted on:

Monday 1st October 2012
View Replies!

Java Image Capture, Buffered Image, Paste in MSWord 2007 problem

I have asked a related question before...but there was no reply. I dont know how to revoke it (may get an answer this time).. so i thought i would ask again.. I am changing the problem statement a bit. Consider the following code for capturing a part of the screen import java.awt.AWTException; import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; public class Capture { public static void main(String[] args) throws AWTException { Rectangle rectangle = new Rectangle(200, 200, 200, 200); BufferedImage img = new Robot().createScreenCapture(rectangle); ImageToClipboard imageToClipboard = new ImageToClipboard(img); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(imageToClipboard, null); } }
VIEWS ON THIS POST

142

Posted on:

Monday 1st October 2012
View Replies!

scrollpane problem

i m making an editor, which has one panel , which inturn has labels which contains the line number and the editor is with frame the problem is when i reachs end of the line surely editor goes up (similar when you type at the end and scrollpane allows you to view the text at the bottom of your editor) my problem is line numbers label doesnt go in upward (though it is in scrollpane) for eg line number max goes to 35 then the screen finishes after that when i press enter editor scrolls down but this number panel doesnt scrolls down i guess this will give you a better idea...what is going wrong public class LineNumberOnEditor { /** * @param args the command line arguments */ private static JEditorPane editor; private JPanel panel; private JFrame frame; private int counter; private PrintWriter tempOut,htmlOut; private BufferedReader reader; private File tempFileLocation, htmlFileLocation; private JLabel numberLabel; private int lineNoInt = 0; private Integer lineNO = lineNoInt; private JPanel lineNumberPanel ; private JScrollPane scrollpane , lineNoScrollpane; private Font font ; public void startEditor() { frame = new JFrame("Editor"); panel = new JPanel(); editor = new JEditorPane(); editor.setPreferredSize(new Dimension(1350,850)); scrollpane = new JScrollPane(editor); numberLabel = new JLabel(lineNO.toString(),JLabel.RIGHT); settingCommonFont(); settingLineNo(); settingKeyAdapter(); numberLabel.setFont(font); editor.setFont(font); editor.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); frame.add(scrollpane,BorderLayout.CENTER); frame.add(lineNoScrollpane,BorderLayout.WEST); frame.pack(); frame.setExtendedState(JFrame.MAXIMIZED_BOTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { // TODO code application logic here new LineNumberOnEditor().startEditor(); } private void settingKeyAdapter() { class KeyListener extends KeyAdapter { @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { incrementingLNumber(); } } private void incrementingLNumber() { lineNoInt++; lineNO = lineNoInt; JLabel numberLabel = new JLabel(lineNO.toString()); lineNumberPanel.add(numberLabel); lineNumberPanel.updateUI(); numberLabel.setFont(font); System.out.println(lineNoInt); } } editor.addKeyListener(new KeyListener()); } private void settingLineNo() { lineNumberPanel = new JPanel(); lineNumberPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 0)); lineNumberPanel.setPreferredSize(new Dimension(60,5)); BoxLayout box = new BoxLayout(lineNumberPanel, BoxLayout.Y_AXIS); lineNumberPanel.setLayout(box); lineNumberPanel.add(numberLabel); lineNoScrollpane = new JScrollPane(lineNumberPanel,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); } private void settingCommonFont() { font = new Font("Times New Roman",Font.BOLD,18); } }
VIEWS ON THIS POST

178

Posted on:

Wednesday 3rd October 2012
View Replies!

problem in getPosition and setPosition......

Cpoint.java import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Cpoint extends JPanel implements Runnable{ int x =400; int y = 25; int dx = 4; int dy = 1; int radius = 20; Cpoint() { Thread thread = new Thread(this); thread.start(); } /*public void setPosition(int x) { this.x = x; }*/ public int getPosition() { return x; } public void run() { // TODO Auto-generated method stub while(true) { if(x+dx>this.getWidth()-radius) { x = this.getWidth()-radius-1; dx = -dx; } else if(x + dx < 0+radius) { x = 0+radius; dx = -dx; } else { x+=dx; } if(y+dy>this.getHeight()-radius) { y = this.getHeight()-radius-1; dy = -dy; } else if(y + dy < 0+radius) { y = 0+radius; dy = -dy; } else { y+=dy; } x+=dx; repaint(); try { Thread.sleep(17); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLUE); g.fillOval(x-radius, y-radius, radius*2,radius*2); System.out.println(this.getPosition()); } }
VIEWS ON THIS POST

122

Posted on:

Wednesday 3rd October 2012
View Replies!

MouseListener events problem

at the start say b=true and a=false; private void addMouseEvents(Graphics g) { this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent me) { if(a){ } if(b){ a=true; } } }
VIEWS ON THIS POST

215

Posted on:

Wednesday 3rd October 2012
View Replies!

problem in ActionListener

i am having problem in this actionlistner while running first time it get called once and next time it called twice then four times and so on here is code please give me any solution thank you very much public void launch() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:cone"); try { Statement st=con.createStatement(); String str="SELECT * FROM quizcontest"; ResultSet rs=st.executeQuery(str); while(rs.next()) { id[i]=rs.getInt("id"); ques[i]=rs.getString("ques"); a[i]=rs.getString("a"); b[i]=rs.getString("b"); c[i]=rs.getString("c"); d[i]=rs.getString("d"); cor[i]=rs.getString("cor"); //System.out.println(" "+id[i]+" "+ques[i]+" "+a[i]+" "+b[i]+" "+c[i]+" "+d[i]); i++; } i--; con.close(); } catch(SQLException e) { System.out.println("Table creation process denied");} } catch(Exception e) { e.printStackTrace(); } } public void display() { // System.out.println("value of g in display="+g+"\n\n"); if(g
VIEWS ON THIS POST

155

Posted on:

Wednesday 3rd October 2012
View Replies!

problem in erasing panel

hey i am new in java n getting this problem i want to create a program in which i am retrieving data from database and showing in gui frame but i want when submit pressed old frame's data should be get erased but instead of that it appends in that thank you for your help package javaapplication48; import java.awt.BorderLayout; import java.io.*; import java.sql.*; import javax.swing.*; import java.awt.event.*; public class JavaApplication48 implements ActionListener { private JFrame f1,f2; ResultSet rs; private JPanel p1,p2,p3,p4,p5; private JLabel l1,l2; private JRadioButton r1,r2,r3,r4; private JButton b1; public int id,i=1; private String ques,a,b,c,d,cor; Box b2=Box.createVerticalBox(); public JavaApplication48() { f1=new JFrame("eww"); f2=new JFrame("result"); b1=new JButton("Submit"); } public void launch() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:cone"); try { Statement st=con.createStatement(); String str="SELECT * FROM quizcontest where id="+i; rs=st.executeQuery(str); while(rs.next()) { id=rs.getInt("id"); ques=rs.getString("ques"); a=rs.getString("a"); b=rs.getString("b"); c=rs.getString("c"); d=rs.getString("d"); cor=rs.getString("cor"); } con.close(); } catch(SQLException e) { System.out.println("Table creation process denied");} } catch(Exception e) { e.printStackTrace(); } p1=new JPanel(); p2=new JPanel(); p3=new JPanel(); p4=new JPanel(); p5=new JPanel(); l1=new JLabel(ques); r1=new JRadioButton(a); r2=new JRadioButton(b); r3=new JRadioButton(c); r4=new JRadioButton(d); p1.add(l1); b2.add(p1); p2.add(r1); p2.add(r2); b2.add(p2); p3.add(r3); p3.add(r4); b2.add(p3); p4.add(b1); b2.add(p4); f1.add(b2,BorderLayout.CENTER); f1.setSize(400,400); //f1.pack(); f1.setVisible(true); b1.addActionListener(this); } // @Override public void actionPerformed(ActionEvent e) { f1.dispose(); i++; launch(); } public static void main(String[] args) { JavaApplication48 ob=new JavaApplication48(); ob.launch(); } }
VIEWS ON THIS POST

172

Posted on:

Wednesday 3rd October 2012
View Replies!

problem in actionlistner

i am having problem in this actionlistner while running first time it get called once and next time it called twice then four times and so on here is code please give me any solution thank you very much public void launch() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:cone"); try { Statement st=con.createStatement(); String str="SELECT * FROM quizcontest"; ResultSet rs=st.executeQuery(str); while(rs.next()) { id[i]=rs.getInt("id"); ques[i]=rs.getString("ques"); a[i]=rs.getString("a"); b[i]=rs.getString("b"); c[i]=rs.getString("c"); d[i]=rs.getString("d"); cor[i]=rs.getString("cor"); //System.out.println(" "+id[i]+" "+ques[i]+" "+a[i]+" "+b[i]+" "+c[i]+" "+d[i]); i++; } i--; con.close(); } catch(SQLException e) { System.out.println("Table creation process denied");} } catch(Exception e) { e.printStackTrace(); } } public void display() { // System.out.println("value of g in display="+g+"\n\n"); if(g
VIEWS ON THIS POST

218

Posted on:

Wednesday 3rd October 2012
View Replies!

problem in actionlistner

i am having problem in this actionlistner while running first time it get called once and next time it called twice then four times and so on here is code please give me any solution thank you very much public void launch() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:cone"); try { Statement st=con.createStatement(); String str="SELECT * FROM quizcontest"; ResultSet rs=st.executeQuery(str); while(rs.next()) { id[i]=rs.getInt("id"); ques[i]=rs.getString("ques"); a[i]=rs.getString("a"); b[i]=rs.getString("b"); c[i]=rs.getString("c"); d[i]=rs.getString("d"); cor[i]=rs.getString("cor"); //System.out.println(" "+id[i]+" "+ques[i]+" "+a[i]+" "+b[i]+" "+c[i]+" "+d[i]); i++; } i--; con.close(); } catch(SQLException e) { System.out.println("Table creation process denied");} } catch(Exception e) { e.printStackTrace(); } } public void display() { // System.out.println("value of g in display="+g+"\n\n"); if(g
VIEWS ON THIS POST

215

Posted on:

Wednesday 3rd October 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

175

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!

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!