Given an onExit() method that is registered as follows :-mainFrame.addWindowListener( new WindowAdapter() {public void windowClosing( WindowEvent e){onExit();}});and the onExit method :-public void onExit(){if (modifiedData){if ...
1158 byte By
dhalla at 2007-9-30 1:04:13
Greetings:I've posted the availability of a library that I've been working on over in the generics forum. http://forum.java.sun.com/thread.jsp?forum=316&thread=495052Rather than make this a blatent cross post, I thought I'd try this instead. The reason why I think folks reading this ...
353 byte By
akb205a at 2007-9-30 1:04:46
Hi friends, i have a problem. It is that i have to compare two strings which are not equal. the famous "!=", does not work. in fact i have a do while loop, where i have to compare two strings till the are not equal. the code are:do{Sytem.out.println("Input: ");// value inputted;} while( ...
8538 byte By
J_Flasha at 2007-9-30 1:04:55
I've got a code that I wanna use in the future but I'm having a problem in it.This line numbering codes works except if you try to open a file it would not open the file.Does anyone know a way to solve this :import java.awt.*;import java.awt.event.*;import javax.swing.*;import ...
In my project there is a main frame. This frame will show up dialogs when some menu is clicked. In these dialogs, I am using constructor super(frame, true)where "frame" is the main frame which shows up the child frames. The problem is whenever I click on the close button on the top right corner ...
Hi,I use a JTable (associated to a model and a scroll pane) and I want to display "..." at the end of a cell content when the column is not large enough. I do not want to use an horizontal scroll, I just want to inform users that data in this cell isn't entirely displayed. For the moment, the ...
Hi,I know this one has been out there a couple of times, but Im having trouble with activating the jpopup by keyboard, and moving it according to the caretposition.Lets say that the popup should be visible when ever the '<' char has been typed, and should then stay visible and move untill ...
Hi,I am pretty new to swing. Here's what I need to know: Is it possible to place components at random locations on a panel? For example by just specifying the x-y coordinates? code sampes would help.ThanksRyan
Hi,I am working with a JTextPane and I would like to receive some kind of notice, when text is highlit in my JTextPane by mouse selection. Based on this I like to make some actions available or not.Any ideas?Best regards, Oliver
1114 byte By
Korvusa at 2007-9-30 1:06:09
Hello,I have a JTree using a custom TreeModel. I've also extended the TreeNode. What is the most elegant method to refresh the tree or only a node withoutcollapsing the currently expanded nodes?Please note that there are multiple types of TreeNodes each representinga different object to ...
Hi,How do I set the focus on the first element of this list rather than clicking via the mouse?I'd like the focus to come to the first element by default and then move the up and downarrow keys?Can anyone help?class Test extends JFrame {Test() {JList list = new JList(new Object[] { "1", "2", ...
425 byte By
sjon123a at 2007-9-30 1:06:21
HiI'm trying to make a JButton and a JLabel in a line, but only the button can be displayed, and the JLabel won't be shown at all. They do work seperately. I looked through many examples, but cannot get the solution. What I would like is something like this layout: < Item ...
133 byte By
maldiva at 2007-9-30 1:06:22
Hello,how is it possible to determine in a JTable if a user switch from the actual cell to an other cell? Tanks!
Hi all,I'm trying to include a button on a tabbed page that will enable you to switch toanother page.I'm using the following code:FlyProGen.addActionListener( new ActionListener() {public void actionPerformed( ActionEvent e ){tabbedpane.setSelectedComponent( container );}} );However, I get ...
I have created a standalone JPopupMenu in my application, which functions as a context menu: it appears when the user right-clicks. My issue is that Java, by default, selectes the first item in the JPopupMenu when it is shown - I don't like this behavior, I would prefer it if the menu would ...
pleze i've form and wanne to print this formi wanne sample code for this thanx
hi!how can i change an image in a jeditorpane when mouse passes over it ?thankstlloreti
508 byte By
pateldwa at 2007-9-30 1:07:04
Hi ,Im want to use a JDialog to pass user values to the following types:connection = new XMPPConnection ("localhost");connection.login ("pateldw", "intel1");As you can see that localhost is the server, pateldw is the username and intel1 is the password. At the moment it is harcoded, but I want ...
Ok, here's the scenario.1] We have the following classes; DrawingPanel extends JLayeredPane DrawingContainer extends JPanel DrawingObject extends JPanel TemporalRelationshipNode extends Point TemporalRelationshipRenderer extends 2DLine2] The following relationships exist DrawingPanel serves ...
Hello there,I am using JEditorPane for an editor. For inserting a single letter, (because of the nature of the application), first I record/store the cursor position in a variable, then I am removing the entire document, Insert the changed text in the document, set the cursor position to ...
Hi to all!Can anyone show me how to correct this code? I am expecting a JProgressBar to show but it never does.What am I doing wrong?Here is my code:import java.awt.*;import java.awt.event.*;import javax.swing.*;public class TProgressBar extends JFrame implements ActionListener{ private static ...
I have several JScrollPanes within a larger JScrollPane, and the deault action when the mouse wheel is moved is to scroll the pane with that the mouse is over.....but I want it to act more like internet exploer where nested scrollPanes are only scrolled with the mouse wheel when they have ...
Hi,I am getting this strange behaviour.I have a cell renderer which displays a list in flwg format:1.[gif] Text6.[gif] TextI have written a small HOT KEY Funtionality.If I press HOT KEYS1,2 OR 3,focus goes to the concerned elements.But not got 4,5 or 6?Can anyone tell me whats wrong if ...
649 byte By
pateldwa at 2007-9-30 1:08:29
Hi, I would like to know how to display a image in a textarea. The displayed image i need to display is in color.I have the following code, but this displays it in gray.textArea = new JTextArea (){final ImageIcon imageIcon = new ImageIcon("top.jpg");JTextArea textArea = new JTextArea() {Image ...
Please help..... I have this code. listed below, that will display the progress bar correctly if called BEFORE I open the main frame in my app... If I call the code elsewhere, i.e after the user has selected a data transfer, the dialog box displays but the progress bar does NOT. public boolean ...
I declare a JTable using the constructor JTable(int numRows, int numColumns) with numRows = 10, and numColumns = 10. When actually setting the data in the JTable using setValueAt method, if I have data only in 5 rows, I will iterate using for loops and set the values in the cells for the first ...
Hi,I have a JTable and I use table model. I also use TableCellRenderer. Now when i use tableChange() method the method getValueAt(int nRow, int nCol) in the model is called recursively forever. It starts with row zero to row 7 and then starts again. I have spent quite some time on it and have ...
I am using two JComboBox's . I want to implement the event listener as Inner Class for both combo boxes.(Not Anonymous Inner Class)Following is the Code. It is not working//Event Listenser EventLis evlis = new EventLis();cbFonts.addActionListener(new EventLis());cbSizes.addActionListener(new ...
Hi everyone,I want to use a normal JTree, but I want to add checkBoxes so that if I check a branch node all its children get selected (just like some installation programs or like PC-cillin antivirus). Does anyone have an idea how to do that?ThanksAlejandro
1019 byte By
dman478a at 2007-9-30 1:09:52
Spring layout is an amazing layout concept, but when it comes down to it, its almost useless.If you have ever tried it, you can set dynamic or static distances between objects. This is useful because it is cross-OS because the components can change size and still be X away from each other. Each ...
I am getting a NullPointerException in a Swing based GUI application when I use the 'Alt' key with JButtons containings mnemonics.There was an earlier topic of the same issue traced to either setLookAndFeel() or using a Frame instead of JFrame. I am using a JFrame and not using ...
how do i increase the width of the lines im drawing on my whiteboard?at the moment they are very narrow, i want a larger "point size" ? thanks
831 byte By
adrpit0a at 2007-9-30 1:10:25
Hello,I was wondering if there is any way of adding some logo or any icon at the right side of the tabs area without that the JTabbedPane has all it's horizontal size full of tabs..______| _TAB1__| | __TAB2__| _TAB3__| |__TAB4_| ...
Ok, this is probably been answered before but I seached and couldn't find the answer. I am going to write my own JTableHeader subclass for a project I'm working on. So far I've barely gotten into it and I've already found a problem. Normally when I drag a column you can see a grey area ...
I have a problem with a JCheckBox, when I assign an Icon to it, the checkBox dissapears and the only thing I see is the Icon. Is there a way to have the CheckBox and the Icon?ThanksAlejandro
I have little experience with swing...... can anyone give me a few pointers on how i would insert data in cells in a table and save them to a database. i want to do this using the setValueAt method. i am using a DAO to connect to the database. This is what i have so far.....public void ...
Hello all,I feel like I'm missing something really obvious, but I've been trying to layout a JPanel which extends the whole width of my JFrame and contains a button on either side. i.e.left frame edge-> | |button|<empty space here>|button| | <-right frame edgeI'm pretty sure I ...
How do you catch key events in a JTree or any Java component for that matter ?
First, I have problems with english. I hope u understand without problems that Im trying to say here. Sorry about that.Mi problem is whit a JScrollPane. I want to put an image whit a predefined size for draw inside it. I dont have any information about it, just the size. I want to put it in a ...
I'm having a problem with printing a JTree. I am creating custom icons for each leaf of the tree based on a few parameters stored in a class that extends the DefaultMutableTreeNode class. All of this works wonderfully, until I try to send it to the printer. At this point the custom icons do ...
Pls help I want to be able to display all rows (students) that paid more than 20 naira in Green else display rows (student) that paid < 20 naira in redBut at the moment it is displaying everything in green why?tmp is the variableCode would help pls!class TestRenderer extends ...
I have replaced a celleditor in a jtable to use a JFormatted textfield. On a single click the editors component is given focus (which I listen to and select the whole field). I get a different behaviour when I navigate to the cell via the keyboard and start typing. This seems to be common for ...
I'm trying to use a JTextArea as a log. I'm using invokeAndWait in an attempt to make it not move on to the next line of code until a line of text has been appended to the JTextArea. The next lines of code are not Swing event-handling or painting, so I'm not sure if the SwingUtilities is ...
Hi, let see if I can explain my problem....I,ve a JTable with Double in its cells. I use a TableModel where I specify the columns and store the data using an Object[][] array and storing Double.The JTable shows me the numbers with an specified format:When the number is decimal uses a "," to ...
hai everyone , i have an applet which upon clicking a button shows a JDialog...i have the jdialog as modal and i want that to stay On top Always ( something like Always On Top option).when ever i visit some other application and come back to this web page i see that the jdialog which popped us ...
Hi,I am facing problem while setting text in 2 separate lines on a JButton.Could any one please let me know how to do that. Any sample code would be highly helpful.cheers,shantanu
I noticed that the function Toolkit.getDefaultToolkit().getFontMetrics(Font) is deprecated but i didnt find anything that replaces this functionIs there a replacment?thanksLiat
Hi, I will try to explain my problem,I want to use a GridBagLayout for laying out the following components:In first line one label for positions 2 and 3.In second line one label and two entries in positions 1, 2 and 3.In first and second line, one label that fill both lines and positions 4 and ...
611 byte By
pfung99a at 2007-9-30 1:13:00
I am trying to make my modeless dialog show up centered at the location where I receive a mouse click message. Since JDialog.setLocation() uses x and y relative to the frame the dialog is associated with, I need to translate the coordinate from my scrollable panel to the frame's coordinate. ...
166 byte By
basotiaa at 2007-9-30 1:13:08
I am displaying some text on applet. but the text displayed is not sharp.Can anyone suggest me how to make text more sharp in whatever font iuse.