Hello allIt seems when I use the setColumns(n) method of JTextArea then only the first line of the JTextArea is being displayed. The work around (please refer to the following code) is to execute pack() twice.If I execute pack() once, then only the first line of the 10-column JTextArea is ...
Hello everyone. I have a class which shows a spashscreen. When run from the main method it display the splash correcly. I have a login module. When the login is sucessful , I call the splashcreen module. Here the problem arises. It just gives me the white background. The image is not there. ...
I have talked to several people lately about how hard it can be to layout components in swing so they are just the right size in the exact location you want them too. I was told by one person that GridBagLayout offers you the most power at the cost of complexity. A friend also said that he ...
I have created a JApplet with an image as background. I also placed JRadioButtons in the applet but they were created with a grey background. Can you set the background of a JRadioButton? If you can, how do you do it?
I have a problem with JTextField focus. Consider the code:class MyPanel extends JPanel {ImageIcon imageIcon;Image image;public MyPanel(Image tiledBackgroundImage) {setOpaque(false);setLayout(new BorderLayout());imageIcon = new ImageIcon(tiledBackgroundImage);image = imageIcon.getImage();}public ...
Hi there!I've got a little problem.I have a JTree and I want to find out, what type my selected object has, for example *.xml, so I want that it gives the String xml back.How can I get to this information?Thanks for helping!
Dear All,is there a manner to get an array of all the items included in JComboBoxThanks in Advance.
Hi GuysI am having a problem setting the preferredSize of a JTextField, no problem setting max or min size. The problem is for example I want - width = 78 & height=18, call setPreferredSize using these values, check the size and it is width=1100 & height=18 The class structure is as ...
Hi *--I like to set a color according to a color that is already defined in the UI. More precise I like to get the color that is used for selection (defined with the look and feel). How can I get this color?Thanks in advance!Cheers, Patrick
I have to search for files having specific extension.After getting folders ant subfolders i have to create a JTreewith this.Pls Help me
Hi foks, anybody as any idea on how to show HTML page in a JTextArea. I could show the HTML as text, but want to view it in JTextArea same as we can see an HTML page in a browser. If the way of doing this is other than using JTextArea, pls let me know. Thanks in advance, ...
Hi im having a big problem with gridbaglayout and text field.The main issue is how to set a fix length for a textfield in a gridbaglayout.This is a example but not the whole reallity for my app but answering it, will surly help me. yx 0 1 2 0| label | textfield | empty|1| table|The thing is how ...
Hi the problem of splash not displaying only arises whem called from anther class. When run run from the main method no problem arises. This is what i don' understand. U have an answer?
I have heard a lot of good things about setting up layouts using JGoodies. Has anyone heard of any disadvantages to JGoodies? For instance, is the code any slower? I was also wondering if anyone else has heard of any other third party alternatives that are used out there. Thanks for your ...
Hi,I have a label that has a tooltip, and i want the tooltip to popup when I tell it to....how can I make the tooltip show up without user putting the mouse on the label?Thanks.
Hi gurus,I have a JTextPane and I setted the editorKit to be a HTMLEditorKit doing:textPane.setContentType("text/html");I tried the following:HTMLDocumenthtmlDoc = (HTMLDocument) textPane.getDocument();HTMLEditorKithtmlKit = ...
Hi folks, I'm trying to put together a java application but have run into trouble with a JPanel that displays graphics.The JPanel is inside of a JScrollPane, which is itself inside of a larger panel in the main JFrame. The JPanel inside of the scrollPane displays some graphics depending upon ...
194 byte By
lks_plma at 2007-9-30 2:02:30
just wantto ask, to create a JButton with image, where do i need to put the .gif file?is it same folder as my program? cause when i run it, there is not image appear on the button.
540 byte By
pateldwa at 2007-9-30 2:03:20
Hi Im trying to display time in my program!Im using this code?!Date today;String dateOut;DateFormat dateFormatter;{dateFormatter = DateFormat.getTimeInstance(DateFormat.SHORT);today = new Date();dateOut = dateFormatter.format(today);}I then attach the dateout to a textarea. Every time I write a ...
282 byte By
Klamraa at 2007-9-30 2:03:52
Hi!Does anyone know how to fetch the whole text from a JTextPane as an AttributedString? It's easy to fetch the text as an unformatted String (with getText()), but how do you fetch the Attributes of the contents of the JTextPane or the corresponding AttributedString?
hi,I am creating a class that extends JWindow, and i want to make my own rectangle, instead of the standard JWindow rectangle.....that appears when you "show" the JWindow.if I override the paint method...how can I change the rectangle that appears? It may seem pointless why I am doing this, but ...
I need to modify the actualy window created when creating a JWindow...for ex:JWindow window = new JWindow();window.setLocation(0,0);window.setSize(100,100);window.show();I want to modify the window that appears when show is called....any ...
261 byte By
javanuia at 2007-9-30 2:04:34
I am writing an application where i have many JFrames on the screen at the same time. The problem is that when i click on a menu item in one of the screens the rest of them get minimized. Is there any way of preventing this without using JInternalFrames.
For a long time, I was looking for a way to get larger fonts with Java applications. With AWT, it seems necessary to modify the source code of the application to create larger Font objects. With the use of Pluggable Look and Feels, I thought Swing did not suffer from this problem, but ...
I am having problems runnning Java applications on some machines,I have found my programs hang at the point where I call this methodsetVisible(true);It never returns from this method.I am working with touch screen mointor and dont know if tht is an issueHas anyone ever had this problem with ...
How to make JWindow always stay on top....meaning, when click on different window my JWindow stays on top.thanks.
Hi there!!I'm just trying to send a some large BufferedImage to printer, can you help me please?Regards!!
hi.for displaying data in a grafhical way i need specific scales in my jTable's columnheader. i also want to realize some sort of "guidelines". do i have to use the java 2d api to draw the guidelines? is there any example out there? anybody who had the same problem?thanx for any ...
HiI have a program that has menu bar actions, one of these actions uses an integer array that was initialised and filled in another method in the class. The array is private variable of the main class. I have an actionperformed method that is used to detect any events from the menubar. When the ...
Hi,I have a class that extends JWindow....but when I add label, i cant see the text..public class myWindow extends JWindow {public myWindow() { setLocation(100,100); setSize(200,200); JLabel label = new JLabel("My label");getConentPane().add(label);}}public class testWindow {public void static ...
723 byte By
deraguna at 2007-9-30 2:05:18
I have searched the archives and haven't found any useful information regarding the fact that creating a JFileChooser lags horribly on some systems...namely mine. I have tried running my own program and the FileChooserDemo on java versions 1.4.1_02, 1.4.1_06, 1.4.2_01-b06, and 1.5.0 beta and ...
407 byte By
sushika at 2007-9-30 2:06:06
I have a problem where the mouse icon stays as a resize icon and doesn't change back to the default icon after the resizing is finished. I have been experiencing this problem ever since i started to use a L&F i created. the thing is, the L&F doesn't touch the mouse definitions and ...
358 byte By
xiejavaa at 2007-9-30 2:06:30
hi, I have a task to make an applet which could editor add, deduce, multiply and divide, integral and differential coefficient, vector, etc. Then to make it as some string to transfer to servere. I do hope other could use it gives a physics and math representation. No need for calculation. How ...
this is my first time trying to use a gridBagLayout and i haven't been able to get it to execute yet. if anyone spots what's wrong i'd really appreciate it. It keeps throwing a null pointer exception when it gets to the import javax.swing.*;import java.awt.event.*;import java.awt.*;public ...
Hi:I've got a new application feature that i'm looking to implement. From user input, i'm lookingto trigger a method that would take an existing GridBagLayout set of components and to addand later subtract swing items from the layout manager. Basically, i'd look at something likevoid ...
I hava string[] like {c:\java\test;c:\java\test1;c:\data;c:\data\data1\data2\}With this i have to create JTree with exact order.give me some code.
My Java environment :java version "1.4.2_03"Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)I was about to start the development of a swing project when I tried the follwoing code just to check the Java installation ...
Hi,I tried to implement a custom ListCellRenderer for a JComboBox:public class StatusComboBoxRenderer implements ListCellRenderer {JLabel label;public StatusComboBoxRenderer() {super();this.label= new JLabel();}public Component getListCellRendererComponent(JList list,Object value,int ...
1007 byte By
lks_plma at 2007-9-30 2:07:32
Hi there,i got this codes online for replacing a word in textarea . The problem is it only replace the first word it match, while other same word still remain un-replace.how to modify it so that it can replace all the particular words that i wantto replace in the textarea.Document doc; ...
In my project, I am using a JTextArea. To remove a particular text in text area, i was selecting the text and I was using cut() function to cut the selected text. This functionality was working fine when I was running the the project on JBuilder. But when I run the same without using JBuilder( ...
381 byte By
Elefanta at 2007-9-30 2:07:44
Hi!I have a JScrollPane where I have added an image with buttons on it. Is there a simple way to determine a specific button is inside the JViewPort, i.e. the user can see it? I know I can calculate it using the JViewPort.getViewRect() and the button's position and size, I just wonder if there ...
I have been trying to use the paint(Graphics g) and print(Graphics g) method on a renderer to print it. I couldn't get it to work (nothing gets printed). I would like to see it work e.g. for checkboxes. I have been able to print a table by using its print method, but by using that one I loose ...
998 byte By
zehda_a at 2007-9-30 2:08:10
Hi, I'm coding up a GUI application and i need to handle many ActionEvents and other events too. What i'm doing now is having my top level class implement the ActionListener and then making 'this' the action listener for all my action events. When it comes to knowing which component fired ...
991 byte By
seawana at 2007-9-30 2:08:19
Hi Gurus,I need to change the text color of an HTML document in my JEditorPane, i.e., update a certain text string's background color dynamically. It works OK when I first run the following function:void changeColor(AccessibleEditableText at, int start, int end, Color color){SimpleAttributeSet ...
Hello everyone,In an applet, I have a JTextPane with a StyledDocument in it as a viewport for a JScrollPane. This is a conversation chat window, so I want that, whenever a new message arrives, the vertical scroll gets automatically to the end of the document.I've tried it in *lots* of ways, ...
Hi ,I am over riding the insertString() method of PlainDocument class.In this method, I aim to insert the string only to a permissible length, beyond which the method should return.Well, this method works, if the string is entered character by character.But if the user pastes a string(of ...
Hello everybody!do you know how to change + and - icons in a JTree?and how to eliminate lines in a Jtree?Thanks in advance!Tlloret
Hi,I'm getting my information out of a database into a result set and then into a table....This code is working fine... but I don't think this is the easy way to do this....Is there a better way to get what I wan't or is this really the way to do it.This is my code:package ...
Is there any reason I am getting this compilation error regarding setToolTipText( )?[COMPILATION ERROR]cannot resolve symbolsymbol: method setToolTipText ( java.lang.String )location: class java.awt.Componentcomponent.setToolTipText( t );[/COMPILATION ...
Hi there,I am trying to print a JTable. Because it doesn't fit on the page I would like to get a subset of the JTable (e.g. coloms 2 .. 3 and rows 15 .. 35). I know all the data is in the tablemodel, but i really would like a subset of the table since this one also contains all the information ...