JTextPane messes up the layout when i apply characterAttributes

963 byte By d.busa at 2007-9-30 0:37:52
Hi experts,i'm working on a text editor using JTextPane with a HTMLEditorKit and a HTMLDocument.whenever i apply a style (e.g. bold, underline ....) using the method setCharacterAttributes in either JTextPane or in the HTMLDocument, the selected text is being changed to bold, underline ... BUT ...

JTextField

382 byte By IloveCAa at 2007-9-30 0:38:44
Hi , I'd like to set the buffer size which user can input not to be attacked by buffer overflow on the JTextfield or JFormatedTextField. For instance, I'd like to set the MAX buffer size of jtextfield 256byte. At first, I tried to setcolumn(). But it seems to set the visible size on them.Any ...

How to repaint Ellipse2D.Double object

3749 byte By MSashaa at 2007-9-30 0:38:49
Hi guys,I have got a silly probleme, that I had never had befor. I trying to develop a game DOTS. a two player game.Each player clicks on a dot in turn. The first player makes a dot red, the second player makes a dot green. and so on.... because I have stopped at this point:). I cant repeint an ...

how to get the DefaultMutableTreeNode from a TreePath

116 byte By hterrollea at 2007-9-30 0:39:00
Hi,I got problem. I do not know how to retreive the DefaultMutableTreeNode from Treepath.Thanks

JTree - make visible new node

646 byte By tune993a at 2007-9-30 0:39:10
I have added a new DefaultMutableTreeNode, as follows, to a JTree:DefaultMutableTreeNode root;jTree = new JTree(root);DefaultTreeModel treeModel = new DefaultTreeModel(root);DefaultMutableTreeNode node = new DefaultMutableTreeNode();treeModel.insertNodeInto(node, root, root.getChildCount());now ...

JFormattedTextField..is it really this hard to use?

704 byte By zehda_a at 2007-9-30 0:39:30
Hi, I'm using JFormattedTextField to read in user input. The input needs to be a valid 5 digits number so i used DecimalFormat and NumberFormatter to put restrictions on the input, and i set the setAllowsInvalid() to false. The problem i'm having now is that when i type in some number and ...

Validating JTable Cell

6790 byte By JCDoerringa at 2007-9-30 0:39:37
For a particular project I'm working on the specs say that as a user types a value into a particular cell in a table, I must validate that each character is valid and that they are typing a valid code.Example: Say valid codes are "01", "02", "10", 11", "20", ... we actually have a large number ...

Dynamically changing/updating a JTable

2555 byte By cperryiiia at 2007-9-30 0:40:40
I have a blank JTable that will add rows as the user clicks the "add rows". My dilemma is some of the objects in the rows are comprised of JCheckBoxes. I need to know how to create an actual checkbox in those spots, without creating a sublass the extends DefaultTableModel. Also i can get ...

JScrollPane makes a double content drawing.. how to avoid it ?

540 byte By alexis.pautrota at 2007-9-30 0:40:42
Hi, I'm developping a game tool in which I'm using a JScrollPane containing a JPanel for which I have redefined the paint(Graphics) method.In order to have the fastest possible rendering, I have disabled the double buffering and defined my panel as opaque.My panel is drawed twice when the ...

Displaying currecny in JTable cell

1680 byte By sandsouzaa at 2007-9-30 0:40:56
Hi,I have a question with regard to the table cell renderer.I have a table with 8 columns .. and the last three columns I have set the renderer to bea Price cell renderer.. which takes a double value and displays in curreny format.$10,000.00..... This works fine ... when I ...

Wrap Text in JLabel

344 byte By naushinga at 2007-9-30 0:41:05
Hello AllIs there a way we can wrap the text in a JLabel. Im dynamically rendering the components on a form, so if the Label Text is too long the frame gets ugly, Im using Gridbaglayout to layout the form components. Is there a way I can wrap the text in JLabel, so that I can get a neat look ...

JTable Selection

286 byte By alejandrosha at 2007-9-30 0:41:27
Hi, I齰e a JTable and need to be notified when a row(or cell) is selected so I can call an specific procedure when a row is selected. I dont know how?I have an AbstractTableModel extended for the table data managing...Anyone could help?Thanks.Al

gradient background

180 byte By SIJPa at 2007-9-30 0:41:42
Hello.I am working on my current project look and feel, and I would like to make my JPanel's Background gradient.is that possible? and if so , how do I do it?

viewing bmp files in Java

247 byte By samir_battaa at 2007-9-30 0:41:48
Hi, I am using JLabel and Image Icon to view images. However, the image processing I am doing invovles bitmap files, but Java recognizes only jpeg, gif or png. Is there some functionality available to use bmp instead?Thanks,SB

JMenu focus problem with JButton

817 byte By greg9504a at 2007-9-30 0:42:12
I am having a problem navigating a menu IF a JButton has the focus.To reproduce the problem:Tab to a button so it has the focus, then do a Alt-F to activate my menu (which has a File menu), then try to use the arrow buttons to navigate the menu, I can't. Pressing escape doesn't work either. ...

How to force JEditorPane to be refreshed?

598 byte By franceslaua at 2007-9-30 0:42:33
Dear all,I've problem of refreshing JEditorPane using setPage( ) method.I've written a simple JAVA browser with an analysing system. When a user clicks a hyperlink, the setPage( ) method will be called. Followed by the setPage( ) method, is another method, called method2, used to analyse the ...

New to programming, trying to learn Java

2130 byte By prevmedonea at 2007-9-30 0:42:36
HelloI am in the process of going through some Java tutorials and am stomped with this excercise and was hoping someone could take a look at it and direct me down the proper path of correctness and knowledge.This is supposed to be a very simple password applet, but has become a mind-bender for ...

JComboBox keyboard selection

393 byte By arbradleya at 2007-9-30 0:42:38
i ma havign a problem. i have a combo box, and when i use the keyboard to navigate tothe choice i wnat (by pressing the down arrow) i catch an ActionEvent every time the selection changes. this does not happen when i use the mouse to mouse over hte choices.the Topley book i have sugesssted ...

BasicComboPopup question

603 byte By tanmaoa at 2007-9-30 0:42:40
I am implementing a function that is similar to the code completion of NetBens IDE.I used the BasicComboPopup class to do this but have some problems:1. Up and Down Arrow Keys don't work with the BasicComboPopup. this is the same problem posted by acj777 on Oct 14, 2003 but it seems he had not ...

Multiple Components in a JScrollPane

846 byte By AR2004a at 2007-9-30 0:42:49
Hi all,I'm trying to create a JScrollPane with multiple components in it, inside a TabPane. However I keep running into problems getting the display working.The contents of the ScrollPane will be determined at runtime and will consist of "n" tables and JLabels, in no particular order. The only ...

JInternalFrame as a dialog

184 byte By ServantOfGlaakia at 2007-9-30 0:43:02
Hi,Is it possible to set a JInternalFrame to be modal on my JDesktopPane similar to the dialogs created by JOptionPane.showInternalMessageDialog()?CheersStu

JOptionPane and Enter Key

150 byte By 771003a at 2007-9-30 0:43:28
Hi! How do I override the default functionality of JOptionPane from Space key to Enter key when OK or Cancel button is in focus? Thanks.

ScrollPane Flow Layout

2090 byte By PervBoya at 2007-9-30 0:43:29
Hi Guys,I am at my wits end as to how I can solve this. I really can't find a solution, I hope you can help.I have a gui layout thus:JTabbedPane -> JScrollPane -> JPanel -> JPanel (instead of awt.canvas)I have multiple java2d 'graphs' that I wish to layout on this scrollpane left to ...

JPanel Question

1110 byte By ii0oo0ooiia at 2007-9-30 0:43:33
I am writing an application where I called a window to be opened. That worked out fine, and as of now the program runs as it should. But I want to open up another, different window. I made this panel in my own class, but how would I write another class for a new panel.?import ...

Scroll to a particular row of a JTable

165 byte By cyshanga at 2007-9-30 0:43:35
Hi, I have a JTable in scrollPane. I would like to know how to make the focus to a particular row (even the row may be not in the current scroll page).

Saving and loading JTree profiles

844 byte By tennis82a at 2007-9-30 0:44:11
Hi all,I have queries regarding saving and loading JTree profiles. The idea is that i can create trees and save the different trees into text files. The next time i want to use them i can just click a load button, select the tree profile i want and load it onto the treePanel.i was thinking ...

Dynamically populating a JMenu

363 byte By DavidJohnMilesa at 2007-9-30 0:44:22
I'm new to Java, but was hoping someone could point me in the right direction for populating a menu with items as it is about to be displayed. This would be a cascading menu off a JMenu off a JMenuBar. I have figured out how to populate the JMenu, but don't know which hook to use to get ...

Forcing a WINDOW_CLOSING Event?

466 byte By GScharfa at 2007-9-30 0:44:26
If the user presses the close button on the title bar of a JDialog, Swing generates a WINDOW_CLOSING event as part of the window closing process.How can I cause this to happen programmatically? I want to emulate the user's pressing the close button with normal Swing processing, including the ...

jdk 1.4 StackoverFlowError

177 byte By tarun22_2000a at 2007-9-30 0:44:37
Hi ,I have a heavy GUI apps that works fine on jdk 1.3 . But when running it uding jdk 1.4 , it gives stackOverFlowError. why is that so ?ThanksTarun

Layered Desktops with menus quetion

477 byte By AndyAleana at 2007-9-30 0:45:11
Hello,I wish to Create this for college system with multiple desktops with seperate menus for each subsystem to keep things tidy is this possible.I would like to have a Floating Toolbar that can set the view to a new functionality.I would like to start with two different functionalities with ...

Disabling actions based on data

3378 byte By paultaylora at 2007-9-30 0:45:27
HiI have a JTable containing data in a spreadsheet . For the JTable I have registered a popu menu which contains a number of actions the actions are also registered with thte table using its inputmap and action map. This allows the user to invoke tasks either using the popup or using keyboard ...

JComboBox

239 byte By aronolsena at 2007-9-30 0:45:40
I am just wondering why JComboBox has been implemented such that setSelectedItem( Object anObject ) makes "anObject" selected instead of the object being looked up in the model ?It doesn't really make sense to me.Aron

Cannot reset the location of a JLabel

370 byte By sheawha at 2007-9-30 0:45:42
I am trying to get information (x,y location) of a JLabel from Database.each time, I new a JLabel, and the I call setLocation(x,y), But the JLabel doesn't go to the specific location,I used jbuilder to debug, I found that the (x,y) are correct, but the JLabel cannot update the location ...

Swing, i18n and fonts

1097 byte By shift244a at 2007-9-30 0:45:49
hi, i'm trying to setup a basic gui with swing that can show multiple languages at the same time. however, i've run into some problems. i can display english and most european text it seems, from a simple font/text test program i've downloaded that displays multiple hello world in different ...

Serious problem with TitledBorder(jPanel)

4371 byte By mebarkiaa at 2007-9-30 0:45:59
I have a serious problem with TitledBorder(jPanel) Here, I have two class the first it contains a jTabbedPane ( class_jTabbedPane)qui call the second which contains a jPanel (Ptableau) which contains a jTable in a jPanel with TitledBorder The problem that one I carry out the jPanel with the ...

Icons question

569 byte By Kristyana at 2007-9-30 0:46:35
Hi am using a JTree to construct a tree from the database. I would like to be able to add open and closed folder icons to the tree. I know the JTree does this automatically but I need more control over what icons are displayed and when.However I can not seem to find these folder icons anywhere, ...

Go to lin ein JTextPane

1255 byte By gurdza at 2007-9-30 0:46:39
Hi All,I'm unable to make that caret position go to a given line no in the JTextPane. I have tried to use setCaretPosition(int) but that seems to give me an error : (I want to set the position of caret to a given line no (i.e. where a method starts) I have got: public void goToLine(String ...

JSlider properties

352 byte By codecraiga at 2007-9-30 0:46:53
Hi,Where can I find these "secret" JSlider properties? I just found out about the isFilled property....for exampleputClientProperty("JSlider.isFilled", new Boolean(true));where can I find these things out ahead of ...

opening a frame from a button

2691 byte By trappedslidera at 2007-9-30 0:46:58
Can some one help me figure out how to get a frame to open ferom a button with input. here is the source code where it would be used. // Programmer:AISC AM Programming class// Jan. 22, 2004// DiseaseSim2 driver to test out People classimport javax.swing.*;import java.awt.*;import ...

Popup Window and Threads -> Rendering failes

1363 byte By RAPHEADa at 2007-9-30 0:47:01
Hi,I ran into serious problems with a small swing app:I have a jframe derived class with the following method:public void quit(){if (licenceServerClient.isLicenceValid()){licenceServerClient.loadingStage = 0; // Reset loading stageProgressMonitor progressMonitor = new ProgressMonitor(this, ...

JTabbedPane API too primitive?

1457 byte By eitan_suesza at 2007-9-30 0:47:42
hello, does anyone else out there wish for a variant of JTabbedPane.addTab() that looked like this?:public void addTab(Component tab, Component body); with such a method, one could pass in a jlabel for the tab component and therefore have complete control over the placement of the icon (and ...

JComboBox Windows Look And Feel

488 byte By johnnyhall81a at 2007-9-30 0:48:13
Hi all,I am using the following method to change the look and feel of my application to my default (Windows). But my JComboBox remains in Metal. Has anyone else encountered this?[CODE]public static void setNativeLookAndFeel(){ ...

JFrame

405 byte By yone3000a at 2007-9-30 0:49:07
I am writing a program that involves drawing a shape, and moving it in a predetermined path around the screen. The implementation involves repainting over and over. Thus, there is some flickering and I have noticed that the speed seems to vary on different systems even though I have set the ...

Flaw or not a FLOw?

1129 byte By alpha@clan66a at 2007-9-30 0:49:09
I came across this problem which i would like you to look at. I really dont know if it is just a problem with my CPU or with every other AMD 1600+ XP.The problem is that, as the Intel Pentium had some numeric problem of the following calculation:4195835-((4195835/3145727)*3145727)and well if i ...

Multiple JDesktopPane Weirdness

1669 byte By mekane8a at 2007-9-30 0:49:21
Sorry if this has already been brought up, but the advanced search features didn't work and I didn't see anything like this in the first couple hundred results that came up for "JInternalFrame".Here's what I've got:I'm working on an app (Using J2SE 1.4.2_01) that uses a JTabbedPane with ...

CellEditor And JList

173 byte By Salouciousa at 2007-9-30 0:49:36
Is it possible to put a cell editor on a Jlist ?I know that i can use a JTable and rendering it like a JList but in my case I prefer use a JList.Thanks.

When do I use invokeLater?

2269 byte By GeoJona at 2007-9-30 0:49:53
Based on the swing tutorial section on the event thread and swing, I was under the impression that I wouldn't have to use invokeLater if I was operating in the event thread and that events like focusGained would execute in the event thread. However, in the following code, if I comment out the ...

JTextField not getting focus

1441 byte By DamienReavea at 2007-9-30 0:50:19
I can't get the cursor to come up on my text field. Every time I set the text of the JTextField, I lose focus and cannot regain it.public synchronized String updateMain(String displayUpdate){mainDis.setText(mainDis.getText().concat("\n"+displayUpdate));try{wait();}catch(Exception ...

Is there such a thing as detailed jdialog in swing?

329 byte By cocoha at 2007-9-30 0:50:50
Hello All,I am looking for an error dialog that can be expanded and contracted to show/"un-show" the details of the error. Is there such a class? I havent really been exposed to the swing api until recently. i need some sort of guidance.Any help is appreciated. Thanks.Best ...

Need to launch Java applets from within a Java Application

477 byte By djracerxa at 2007-9-30 0:50:51
Greetings, I am trying to launch Java Applications or Java Applets (mainly applets) from within my Java Application.... I was thinking about using a JEditorPane and launching Java Applets from that since it supports HTML, but the JEditorPane is not a Java compatible browser. Does anyone have ny ...