Putting user input into a inner panel onto one line

8419 byte By vopoa at 2007-11-27 11:59:46
Hi,I'm trying to find a way to add the JSpinner and JComboBox text into a panel. I've read some tutorials, but I still can't find a way to add my text into a panel.Here are some of the details:-when a JSpinner number is selected, it would appear in the blue bordered panel-when a JComboBox is ...

Removing from JList

327 byte By java4life87a at 2007-11-27 11:59:27
I have a JList comprised of People object. What I want to do is when the user right clicks on one of the People objects an option comes up (in menu form or something) that says remove. Upon clicking remove, I want the person object removed from the JList.Any suggestions on how to implement ...

Animations in gui

166 byte By Oleka at 2007-11-27 11:59:13
<p>Hi,</p><p>Can someone tell me how i can set some animations like the hovering in panels in xp-menus?</p><p>Or uphovering text in for a component.</p><p>regards</p>

printing information in a gui

856 byte By morganista at 2007-11-27 11:59:11
Hi I want to be able to do a printout of some information that I have in gui. Does any body know any code that I could use or if there is any documentation on how to do it. I know that you can do printouts of tables but I haven't been able to find any documentation on print outs of information ...

focus tranfer between panels

347 byte By javalover2002a at 2007-11-27 11:59:05
I have a panel which has two panels classes, panel1 and panel2.panel1 has few textareas/combos and panel2 also has some textareas/combs.user tabs between the fields in panel1. but when user tabs on the last field of panel1, i want the focus tranfer to panel2's first field.how do i do that, please ...

graphics method in a class extending jFrame

341 byte By dogukana at 2007-11-27 11:59:01
for example in my program i want to draw a colorful line and before using getgraphics().drawline(..) i want to set the color to something by using setcolor() method.is it possible to use the methods getGraphics().setColor(Color...) in a class extending JFrame?i have a problem here. Whenever i used ...

JTextfield: Changing focus, then doing stuff

915 byte By Flavouskia at 2007-11-27 11:58:43
So I have 3 JTextFields that are essentially "connected" (I automate tabbing and such back and forth). I have no problem gaining focus, whether it be transferFocusBackward(), or whatever else. My problem is when getting the focus I cannot do anything with it like taking the letter the user typed ...

Graphics2D & JTextField Problem

437 byte By kerryblue19a at 2007-11-27 11:58:02
I'm trying to add a JTextField to a JPanel which paints a bunch of lines and what not using Grahpics2D but the JTextField doesn't show up. Is there anything I'm missing in terms of functionality? The way I was adding it was in the constructor for the class that extends JPanel.CheersPS I didn't ...

How to create an

1026 byte By thoto001a at 2007-11-27 11:57:53
Hi folks,I'm having a weird problem to solve.I have a JFrame, displaying some texts (JTextpane).Now, I want to open a Search dialog, entering some word into its text field, press "Search" button of the dialog and set the caret to the first occurance in the text pane that is located in my ...

property change listener error with jtabbedpane

2053 byte By h2opologirly69a at 2007-11-27 11:57:49
GreetingsI have a property change listener on my jtabbedpane (2 panes (index 0 of course and index 1). my problem is when i want to run my app it gives me a java null pointer exception. I believe it is b/c it is starting the app and it see the property change of the first tab at index 0 which is ...

FileRenderer

426 byte By tarmenela at 2007-11-27 11:57:39
Hi there all,I'm trying to create a Jlist that will show either a folder or file that I have added to it from a JFileChooser. I've been able to create my own ListCellRenderer but was wondering if there is not already something out there. Secondly I would like to create my own Cell Renderer but ...

file contents in jtextarea

1554 byte By jonathanca at 2007-11-27 11:57:28
i have the following program but i need to edit it in order to open the text file and display its contents in a jtextarea anyone know what i have done wrong so far and what i need to change import java.io.*;import java.awt.*;import javax.swing.*;//this is a cprogram i have created so the users data ...

Placing Buttons

999 byte By lesnaubra at 2007-11-27 11:56:53
I am trying to place a button in a specific location inside of an internal frame. I was thinking that I could use the setLocation method but that doesnt seem to work. The button's picture icon is not showing up at all. I think it is because I need to seta certain layout for the content pane first. ...

FileChooser - select only directories but still see files?

394 byte By allelopatha at 2007-11-27 11:56:50
Is it possible to have a JFileChooser that, while only allowing a directory to be selected, still shows files in the text area?If I set this:fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);it indeed allows only directories to be selected, but I can't see files in the directory ...

Show always last line on textarea

638 byte By asilazmaza at 2007-11-27 11:56:37
Hi java world,i have a textarea as viewport of a scrollpane. When new text is added into text area , the lines go under scroll. I want that when the the lines are added, always my last text (last line) is shown. How can i do this.?scrollPane1 = new JScrollPane();textArea1 = new ...

JFrame addWindowListener doesn't work -- alternative close button action

936 byte By frost986a at 2007-11-27 11:56:27
Hello,I am trying to get a program to save some data to a DB before exiting; So I need to assign a customer listener for the close button of the program.This is that what I have tried so far:private void initComponents(){this.addWindowListener(new WindowAdapter(){public void ...

Something about how to locate the coordinates

1086 byte By jack_hzya at 2007-11-27 11:56:24
Hello guys, I got problem in locating coordinates, and kinda hoping anybody can help me out.I am intend to draw a circle and small 3D Rectangle. I want to use a Timer to rapaint the painting and make the rectangle can move on the circle SMOOTHLY, so I use the code xRec = (int) xCentre + radius * ...

Heavy JInternalFrame will not be fixed?!!

333 byte By Dmitria at 2007-11-27 11:55:00
HelloI just got the message from the bugdatabase: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4154448Old State: In progress, request for enhancementNew State: Closed, will not be fixedAfter more then 10 years of waiting it will not be fixed?!!!! f...Can somebody explain me ...

Problem adding Child in AbstractTreeTableModel

479 byte By Irfan_dcrtia at 2007-11-27 11:54:49
Hello,I have a AbstractTreeTableModel. Root|Parent|Child 1Adding of any number of parents is working fine. But When I try to add the second child, the child is not shown in the view. But I can see that the CHild 2,... gets inserted into the Model? Can anyone help me please in resolving this issue?I ...

JTextField cannot capture value from different classes

2683 byte By arjensena at 2007-11-27 11:54:26
Hi all,The solution is it have two different classes, class 1 and class 2. I wan to send a value from class 1 to the JTextField in the class 2. I had try many times, but no idea for it. The value can send from class 1 but textfield in class 2 cannot receive. Anyone got idea. Below is the code:Class ...

Highlight ComboBox

387 byte By asilazmaza at 2007-11-27 11:54:08
Hi everybody,i want to set editable a combobox and set selected(highligted) the first index when i pressed F2. The code i write below;comboBox.addKeyListener(new KeyAdapter(){public void keyPressed(KeyEvent e) {if(e.getKeyCode() == KeyEvent.VK_F2){//?comboBox.setEditable(true);}}});how can i set ...

Flashing undecorated JDialog on resize+setLocation

53331 byte By BuggyVBa at 2007-11-27 11:54:02
Hi everyoneI have a undecorated JDialog with custome resize code. Here is a part of my codeframe.setUndecorated(true);frame.addMouseListener(new MouseListener(){public void mousePressed(MouseEvent e) {sp = e.getPoint();compStartHeight = frame.getSize().height;compStartWidth = ...

Spaces in JTextPane

4224 byte By Sarjaya at 2007-11-27 11:53:36
Hi...I have a issue using JTextPane. When i given more than one space between characters and reseting the same HTML text, multiple spaces are converted to single spaces.Steps to produce the above issue :-1. Run the below.2. Exter some text=>more than one space=>some text again.3. Click "Show HTML" ...

Text autocomplete , how to implement for each word

6131 byte By rayees1234a at 2007-11-27 11:53:24
This is the code for text auto completed Hi this code will check only the first entered text any one help me out check each wordie if we entered "o" the text organization will display after we gave a "space" then enter the "o" again its not displaying the "organization again, any one can help me ...

resizing an imageIcon of a jLabel on a jLayeredPane

590 byte By Kojow777a at 2007-11-27 11:53:12
I have 2 questions, somewhat related:Question 1:I have a jLayeredPane with a number of jLabels of imageIcons. I need to resize the top imageIcon when I move a slider. To get the top component on the jLayeredPane, I use: Component topComponent = layeredPane.getComponent(0);However, I can't figure ...

JTextfield listening for changes from other class

888 byte By tsg-8888a at 2007-11-27 11:52:28
Hi,Assuming I have a Jtextfield in one of the class1 extend Jframe,how do I update the jtextfield so that it could up make accessible by other class and continuously updated to reflect the input for value rom another class2. In other words very much similar to the observable model view conceptclass ...

All Frames in One

312 byte By blackmagea at 2007-11-27 11:52:24
On Windows, each new JFrame created also creates a new taskbar at the bottom of the screen. And for the task bar not to show using a JFrame, editing has to be done to the native code, correct?Well is there a way to have the task bar appear as one and not spread out across the bottom of the ...

JTable cell color change Single METHOD

483 byte By Cosaia at 2007-11-27 11:52:03
I searched the forum but I could not find a method that is something like changer(int row,int column, Color color).the examples show that I should rewrite a method of a class which is derived from defaultTableCellRenderer. In that case as I understand I should wire the algorithm to change the cells ...

Centering a single line in the middle of a JTextPane

1576 byte By jezzica85a at 2007-11-27 11:51:57
Hi everybody,I'm trying to center a line of text designated as a divider on a JTextPane, and only that text. For some reason, though, when I do that, it centers all the text below the divider on the JTextPane too. The relevant code for this is:MutableAttributeSet bodyCenter = new ...

Problem aligning components on a panel using GridBagLayout and GBC

6286 byte By scshekhara at 2007-11-27 11:51:56
I am developing a GUI where I will be having several rows of label/textfield pairs ( each row will have at the most 3 pairs ). I just started with 2 rows. The first row has 2 label/textfield pairs and the second row has 3 label/textfield pairs. I am running of out ideas on how to make them aligned ...

JTable help needed

631 byte By PingGuya at 2007-11-27 11:51:40
Is there a way to get programmatic control of the actual text editor that is used by JTable when you are modifying text within the table? I want to be able to change the default behavior of the editor but so far I can't find a way to even access it. I've been playing around with the ...

Enable a search button as soon as a character is entered in text field

1868 byte By SDNJavaa at 2007-11-27 11:51:23
I have a text field (java swing) and a search button.When the user hits RETURN, the text field fires an action event.Is it possible that as soon as I enter a character in the text field, it fires an action event without hitting the RETURN key or pressing the search button?What I want to achieve is, ...

setPreferredSize across 2 monitors

584 byte By ricochet_008a at 2007-11-27 11:51:08
I have 2 monitors and I want a JFrame to be displayed across the 2 monitors.when I force the frame to be set with the size it seems to have the dimensions I entered but does not span across the 2 monitors.JFrame frametest = new JFrame();frametest.setPreferredSize(new Dimension(2280,1520)); // width ...

JComboBox renderer closes after each selection

50340 byte By programmer_girla at 2007-11-27 11:51:03
Hello,This follows my previous post regarding "How to add JCheckBox objects to JComboBox". With Ice's help, I've managed to make some good progress. So now I'm having other issues as I go further.In the code below, I have the following issues:1. My JComboBox renderer closes after each selection ...

Updating JTable cell after sorting by column

348 byte By Santosh.Bhushana at 2007-11-27 11:50:47
When i update a cell data of JTable after sorting it by one column, though the data gets updated but it does not remain sorted and the data appears back as it appeared for the first time. How can i ensure that the data table structure does not change once i update a cell apart from the cell which i ...

Refreshing JTree

629 byte By Alantiea at 2007-11-27 11:50:43
I already find that refreshing JTree trouble is usual question - but never seen answer on my problem.i am using JTree and model implementing FileTreeModel. i have popup menu with "delete file" for example and when i m pushing it - i do the following code:boolean success = (new ...

JTreeTable row selection

232 byte By nicecude31a at 2007-11-27 11:50:06
<p>Hi Guys,</p><p>Is there a way i can select the row in a table, without actually passing the focus to that row. I want to programatically highlight the row instead of selecting it. please help me in this regard</p><p>-nicedude</p>

Image in header of print (JTable)

1213 byte By hes01a at 2007-11-27 11:49:41
Hello,I have a question about printing a JTable. I use the following code which works well but I want to extend my print with a image (a logo) in the header of every page. What is the best way to achieve this?My second question is how I can change the font size of the header?Thanks for your ...

How do I get the GidBagLayout location from my buttons?

1960 byte By Nizzlea at 2007-11-27 11:49:25
How could I get the location of my JButtons (or JLabels) in my GridBoxLayout?I've tried all that I could think of..here some code sampleJButton button;GridBagLayout layout = new GridBagLayout();[...]GridBagConstraints c = new GridBagConstraints();c.weightx = 0.5;c.weighty = 0.5;c.insets = new ...

Document Listener not working the way i would like

693 byte By noe.rochaa at 2007-11-27 11:49:23
Hello.I have this situation:A Jtable and a field of JTextfields that are populated by clicking on the JTable rows or manual inserction.All the JTextFields have a DocumentListener attached.When i click on a row, every JTextField that is populated fires a insertUpdate and a removeUpdate event(the 1st ...

Does it matter the order?

371 byte By ardmorea at 2007-11-27 11:49:22
<appletcodebase="."code ="test.class"archive = "some.jar"...and><appletcode ="test.class"codebase="."archive = ...

Problems with a JTextField inside of a JTextPane

7500 byte By Naquadaa at 2007-11-27 11:48:53
I have a JTextPane that needs to have individual words or phrases (in the DefaultStyledDocument) that can generate a MouseEvent. I've tried wrapping a JTextField in a Style (when adding it to the StyledDocument), this works nice and does create the type of MouseEvents that I'm looking for. But ...

java.lang.NullPointerException when scrolling in JComboBox

4032 byte By Jethroa at 2007-11-27 11:48:49
Hi everybody,I use a JComboBox in my application. If I scroll it a NullPointerException is thrown:java.lang.NullPointerExceptionat javax.swing.BufferStrategyPaintManager.flushAccumulatedRegion(BufferStrategyPaintManager.java:406)at ...

Paste printing in reverse order

793 byte By CodeXa at 2007-11-27 11:47:50
Hi i am using this code as the Document Stylepublic void insertString(int offs, String str, AttributeSet a) throws BadLocationException {try{for (int i = 0; i < str.length(); i++) {// for(int i = str.length() ; i > 0 ; i--){ String s = String.valueOf(str.charAt(i));if(Main.Mainmenu.seqmode==3) ...

Hide Arrow of the

272 byte By ekoshaa at 2007-11-27 11:47:38
<p>Hay All,</p><p>I am using a JComboBox and I wish to remove the arrow button that triggers the Popupmenu as I use an alternative way and the arrow is redundant and making my application ugly :) ...... is there a way to remove this button?</p><p>Thanks for your Help!</p>

How can a JTextField make the add() method believe it's another object?

739 byte By micro5a at 2007-11-27 11:47:34
I have created a HistoryTextField class that is supposed to replace any JTextField. It is actually an editable JComboBox that stores previously entered values so the user can choose from them. Everything works nicely, my only problem is that it is not compatible with JTextField because my class now ...

disableEvents( AWTEvent.KEY_EVENT_MASK);

320 byte By doron1970a at 2007-11-27 11:47:23
Hi,I'm using disableEvents( AWTEvent.KEY_EVENT_MASK)in my aplet cause I want to stop sending key events at some point, but it doesn't do anything.Do you know why?Do you know how to use this feature properly?Any better suggestion how to stop sending ...

JEditorPane throws "java.lang.RuntimeException: Unclosed comment"

2239 byte By SenNira at 2007-11-27 11:47:05
[java version "1.6.0_01"Java(TM) SE Runtime Environment (build 1.6.0_01-b06)Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)]Code to generate this problem :import javax.swing.*;import java.io.*;public class TestJEditorPane {public static void main(String[] args) throws ...

Row and Col count

147 byte By CodeXa at 2007-11-27 11:46:47
<p>Hi guys... i am using a Text Plane as my GUI component ...</p><p>How can i get the row count and column count of the current caret location.</p>

Moving around in a j scroll pane.

407 byte By jpeanuta at 2007-11-27 11:46:37
I have a JTextArea inside a JScrollPane and I'm trying to get the scroll pane to goto a certain line number that I want by using:TA.setCaretPosition(10*linenumber);the linenumber is the line number the user enters and then the 10 is just the pixel it will go down because the interval I counted ...