I have tried to get the width of a component.Let say I have the following codeJPanel panel = new JPanel();JTextField text = new JTextField();text.setSize( (int)(panel.getWidth() * .9) ,(int)(panel.getHeight() * .9) );panel.add( sourceText );it seems like that the default width and height of a ...
Comments (15) | Promote | Bookmark
changing a components UITue, 18 Sep 2007 08:53:00 GMThow would i change a components UI, for example.. how would i change the UI of the JFileChooser to only display the DirectoryDrop-Down, UP-Dirrector, and New Folder button on the top, and only the FileName TextField on the bottom, but still keep it's functionallity with the ability to select ...
Comments (9) | Promote | Bookmark
JTable -> JComboBox/List -> JTableFri, 21 Sep 2007 17:28:00 GMTMy target: I would like to have multiple columns in my comboBox or list. When I choose one item, the result would be just a single column but not all columns. Moreover, the whole comboBox is actually one cell within a JTable. i.e. when I click one cell of a jtable, it shows a comboBox.I have ...
Comments (9) | Promote | Bookmark
Drag n Drop between JFramesFri, 21 Sep 2007 22:29:00 GMTHi,I am trying to to drag and drop between two JFrame windows. Specifically, in window A I have a JTable that I want to drag a selected row onto a JLabel with an ImageIcon on Window B (the icon is simply a visual cue to the user about where to drop). I've looked at the examples at Sun and read ...
Comments (7) | Promote | Bookmark
Scrollable Text AreaWed, 19 Sep 2007 00:36:00 GMTHi,Can I know how to make a Text Area to be scrollable?Below are the snippet of my code. I tried using two ways to code my text area so that it can be scrollable but sadly it didn't work.Can anyone please kindly let me know what I did wrong?=========================================JPanel c = ...
Comments (6) | Promote | Bookmark
How to catch window maximised event ?Thu, 20 Sep 2007 23:48:00 GMTI know I need to creat class that will implement WindowListener. But what even should I catch ? And also... I need to restrict this function... so my window can't be maximised... how do i do this ? Any hints ? Please help....
Comments (4) | Promote | Bookmark
Changing the column name in JTableWed, 16 Jul 2008 18:55:00 GMTI am creating a table using swings JTable with some columns.i need to change the column names when i click on a particular button.How can i achieve my target?Thanks in advance for any help.[ October 17, 2005: Message edited by: Amrutha Ch ]...
Comments (4) | Promote | Bookmark
The system is not showing the UI as soon as i opened the frameSat, 22 Sep 2007 01:55:00 GMTHello!I am writing an application in that on clicking on the Button another window will open. In that frame 4 buttons must b visible. I was not able to see untill i am pressing twice on the button. Can any one tell the reason for that problem.Thanks for any help.Rajani ...
Comments (4) | Promote | Bookmark
Making data waitFri, 21 Sep 2007 05:51:00 GMTHow would I make part of my program wait for me to inpput data into my GUI text fields before it tries to input the blank fields?...
Comments (3) | Promote | Bookmark
How to keep the vertical slider always at bottom in a JScrollPane?Wed, 19 Sep 2007 20:27:00 GMTHi,I have a method as pasted below in my java application to show some info to the user. When the info has been appendd upon the sbuf and posted in the JTextArea, I like user to be able to focus on the bottom of the TextArea since most recently has been appended at bottom.Thanks for your ...
Comments (3) | Promote | Bookmark
Dumb question about GC in SwingWed, 16 Jul 2008 19:04:00 GMTHi guys,I have a very basic question :Supposing I have the following code :code:class MyWindow extends javax.swing.JFrame{ // ... Main window of the application}class MyApp{ public static void main(String ... args){ java.awt.EventQueue.invokeLater(new Runnable() { public void run() {new MyWindow...
Comments (3) | Promote | Bookmark
Memory LeakFri, 21 Sep 2007 01:20:00 GMTHi All,A Popup menu has a menuitem which when clicked creates a tree.Now when the tree is no longer required i set the popup menu to null. so too with the tree. but when i run OptimizeIT , JProbe i find that neither the popup menuitem nor the tree is disposed (GC). the referrer is always ...
Comments (3) | Promote | Bookmark
Firing KeyEvent for Backspace issue.Wed, 16 Jul 2008 19:17:00 GMTOk here is the issue the code below works in java 1.5 but not in java 1.4 or below. Does anyone know of any workarounds to get this working in 1.4?I am wanting to fire a backspace keyevent by having the user push a button on the screencode: if (!phone_txt.hasFocus()) phone_txt.requestFocus(); ja...
Comments (3) | Promote | Bookmark
Cannot display JLabel text in JTableWed, 19 Sep 2007 06:36:00 GMTHi, This is a simple but frustrating little problemI am having trouble displaying the label text in a column of a JTable.I have hacked up a copy of TableDialogEditDemo.java from the tutorialson using JTables. This uses a renderer and editor models to deal with acolumn of colors.I have changed ...
Comments (2) | Promote | Bookmark
how to populate data in a JTable?Wed, 19 Sep 2007 01:08:00 GMThi there can anyone tell me how to populate data in a JTable? when a table is displayed, the table should have data retrieved from a file. thank you. ...
Comments (2) | Promote | Bookmark
Mouse events...Tue, 18 Sep 2007 17:24:00 GMTI want to give functionality to the right mouse click in a JList. However, if I right-click on an item in the list, focus does not move to that item, as if only left-click is listened to.How can I make right-click work?Thank you all. ...
Comments (2) | Promote | Bookmark
About java. awtWed, 16 Jul 2008 19:16:00 GMTWhich two statements are true? (Choose two).a. The button labeled North and South will have the same widthb. The button labeled North and South will have the same height.c. The height of the button labeled North can vary if the Frame is resized.d. The height of the button labeled South can vary...
Comments (1) | Promote | Bookmark
Command line argumentsWed, 16 Jul 2008 19:00:00 GMThi all, can anyone tell me how to get command line arguments in the form of string array in java. thanks in advance....
Comments (1) | Promote | Bookmark
JAppletTue, 18 Sep 2007 19:14:00 GMTHi there:I have an applet and i'm reading some values from a JComboBox and store them into an array.Now i'm drawing them but everytime i changed, i use repaint().But i want to see them changing like a sliding.If somebody helps me giving an idea i will be thankful.Thanks ...
Comments (1) | Promote | Bookmark
Problem with 1.3Wed, 16 Jul 2008 19:11:00 GMTAll,JRE 1.3.I got JFrame with few JTextEdits fields. When losing focus values of these fields are validated. Sometimes (it is hard to reproduce) it happens that I got cursor in more then one component! The only recovery is to restart application. Do you know about such problem and possible solut...
Comments (1) | Promote | Bookmark
How to access OK & Cancel in JOptionPane ?Tue, 18 Sep 2007 11:28:00 GMTI use this code to ask the user for a value :String y= JOptionPane.showInputDialog("Please input a value") ;How do I know if he presses OK or Cancel....its all the same for the String y.What's the code for obtaining this choice ? ...
Comments (1) | Promote | Bookmark
seeking method of getting free disk spaceWed, 16 Jul 2008 19:12:00 GMTI am trying to see how I can get the available disk space on the PC that my application is running on. The target OS of my application is currently Windows NT but I would also like to be able to do the same thing on a UNIX box. Any ideas?Lon Allen...
Comments (0) | Promote | Bookmark
Creating, Formatting & Printing a DocumentWed, 16 Jul 2008 18:37:00 GMTHi all,I want to be able to pull various items of data from a database, add a few graphics and then be able to print. I've read lots of stuff online and in past posts about this, but does anybody have any suggestions of where to start? Should I first make a GUI, display all the items in thei...
Comments (0) | Promote | Bookmark
JTree addSelectionPath & ClassCastExceptionsFri, 21 Sep 2007 19:35:00 GMTHi.I'm trying to build a tree view from a list of strings that represent relative path names (ie: Icons\a\image.dds)I have tokenized the path name based on the file separator and placed it into a String array which is used to create a new TreePath object, but when I try to add the tree path to ...
Comments (0) | Promote | Bookmark
put application in system trayThu, 20 Sep 2007 21:14:00 GMThow to put an application in system tray , i have made a messenger wants it to be like msn or yahoo , so how to put it in system tray?...
Comments (0) | Promote | Bookmark
Printing helpThu, 20 Sep 2007 08:22:00 GMTDear Sir, I have developed an application that shows some reports in a JTable. I have also put my problem b4 in this forum. I took help to print the JTable but it doesnt print the vertical and horizontal lines. Please help me in this regardYours ...
Comments (0) | Promote | Bookmark
JPanel within JPanel & updateUIWed, 16 Jul 2008 19:14:00 GMTHi,I have a JPanel within a JPanel. Let's say JPanel A is within JPanel B. If I want to refresh A, should I refresh B too? If so, what is the order?Below is some of my code. Is it the right way to refresh the JPanel?Thank you.Sincerely,Mulyadi Kurniawan=======...profitInfo = new JPanel();pro...
Comments (0) | Promote | Bookmark
Inserting a link.Tue, 18 Sep 2007 07:55:00 GMTHello,Is it possible to insert a link to a web page in a JPanel, in the same way we can add labels, textfields, etc.?Thanks. ...
Comments (0) | Promote | Bookmark
Making JTree Nodes invisible when i expand one of the Tree NodesFri, 21 Sep 2007 05:40:00 GMTHello,I have got a problem when i work with JTree.I want to have a JTree in which if i click one of the TreeNodes (Which is one of the child nodes of the root),the other tree nodes should not be visible.(Ie,.The other Tree nodes except the TreeNode which i clicked should turn invisible and the ...
Comments (0) | Promote | Bookmark
Borland datasets & swingWed, 16 Jul 2008 18:56:00 GMTdoes anyone have any online references to using swing tools and Borland datasets?thank you,...
I am trying to see how I can get the available disk space on the PC that my application is running on. The target OS of my application is currently Windows NT but I would also like to be able to do the same thing on a UNIX box. Any ideas?Lon Allen...
Hi all,I want to be able to pull various items of data from a database, add a few graphics and then be able to print. I've read lots of stuff online and in past posts about this, but does anybody have any suggestions of where to start? Should I first make a GUI, display all the items in thei...
Hi.I'm trying to build a tree view from a list of strings that represent relative path names (ie: Icons\a\image.dds)I have tokenized the path name based on the file separator and placed it into a String array which is used to create a new TreePath object, but when I try to add the tree path to ...
how to put an application in system tray , i have made a messenger wants it to be like msn or yahoo , so how to put it in system tray?...
Dear Sir, I have developed an application that shows some reports in a JTable. I have also put my problem b4 in this forum. I took help to print the JTable but it doesnt print the vertical and horizontal lines. Please help me in this regardYours ...
Hi,I have a JPanel within a JPanel. Let's say JPanel A is within JPanel B. If I want to refresh A, should I refresh B too? If so, what is the order?Below is some of my code. Is it the right way to refresh the JPanel?Thank you.Sincerely,Mulyadi Kurniawan=======...profitInfo = new JPanel();pro...
Hello,Is it possible to insert a link to a web page in a JPanel, in the same way we can add labels, textfields, etc.?Thanks. ...
Hello,I have got a problem when i work with JTree.I want to have a JTree in which if i click one of the TreeNodes (Which is one of the child nodes of the root),the other tree nodes should not be visible.(Ie,.The other Tree nodes except the TreeNode which i clicked should turn invisible and the ...
does anyone have any online references to using swing tools and Borland datasets?thank you,...
All,JRE 1.3.I got JFrame with few JTextEdits fields. When losing focus values of these fields are validated. Sometimes (it is hard to reproduce) it happens that I got cursor in more then one component! The only recovery is to restart application. Do you know about such problem and possible solut...