santhosh varala kumar

+ Follow
since Nov 05, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by santhosh varala kumar

Dear Akshata Alandker,

You can use

Math.round(i) i can be any float or double value.
6 years ago
In that case you need to overrite your own basic progressbar ui so that while painting it will under go and draw how we have specified.
8 years ago
Check this
8 years ago
By using
a) javax.print API
b) java.awt.paint
c) javax.swing.RepaintManager
8 years ago
Best thing you can go for eclipse.

Priority wise :
1. Eclipse --Useful very much (provides a lot more option)
2. Netbeans
8 years ago

Lesole Mphinyane wrote:hey i have done some gui screens, each screen has its own class.

how do i navigate to the other screen using JButton?

Link with listener of the button for the next screeen
9 years ago

Rob Camick wrote:

I am still using notepad for writing my code and using command line for compilation.) i will now download some Integrated Development Environment

Me too, I use a simple text based editor and a command line for compiling this does not prevent you for using standard intendation of your code.

How hard is it to type spaces or add a tab character at the beginning of a line?

Properly formatted code will make it much easier to read and understand your code, thus prevent silly errors like mismatched brackets and so on.

Best thing you write the codeby using IDE
such IDE can be
1. Net beans
2. Eclipse
which will do format for you.
9 years ago

mark chester goking wrote:hi maneesh, yes you are right.
i was looking for a way not to do that kind of thing. what i did was add a variable inside the itemstatechanged instead so it wouldnt get executed

Basically their are ways we can do it.

1. Playing around with addListener and remove listener while updating the selected item.

2. As you said you can use a variable as to process the code after firing the event. Its purely depends on flag settings.(this becomes a patch work).

3.You can override the firing the events, when updating is done (whether to fire or not). This can be done custommodels which implement abstract event listener.
9 years ago
Steps can we follow
1. Create a table Model with given column names and zero rows
2. Create a JTable instance with table model as parameter.
3. Then Dynamically adding rows can be done by using addRow() method.


If your trying to use different models for the same table. Then in that case we can go for the setModel method concept.
To visible colNames in JTables , you need to put JTable inside a jScrollPane.

For More about Jtable and its corresponding model. Read JAVA API..,.

9 years ago

Maneesh Godbole wrote:Ambika,
In future, while posting code, please use code tags

Check the following code
9 years ago

Rob Prime wrote:Moses, could you please use code tags next time?

Basically their are 2 ways to do it:

1. One usage tablecolumn model directly as mentioned in earlier comment.

2. You can set the column size explicitly by setWidth method
here is the sample:
Dimension dim = table.getPreferredSize();
int width = dim.width / 4;
table.getColumnModel().getColumn(1).setPreferredWidth(width * 15);
9 years ago

Rob Prime wrote:Because check boxes only work for Booleans perhaps? You can add Strings to your TableModel all you want, just not for the check box column.

1. In TableModel, getColumnClass() should return Boolean.class insteadof String.class
and the values in that column should be boolean value.

9 years ago

Ganesh Rayner wrote:Hi Rob Camick,

Thanks for the detailed response. I cannot use Swing utilities which is the part of java 1.6. For our application
we are using java 1.5. We have to stick with 1.5 for a while. I tried timer as mentioned in the Java Swing timers.
But not seems to be working. Currently i have created a seperate thread and updating the text pane. It is littlle
bit slow but seems to be ok. The only problem is light flickering is happening when i am updating the lines.Is it
possible to make the repaint state idle for while till i am updating.Because when the lines are getting added
Autoscroll should not happen. I have disabled that.But still flickering is there.Any thing i can do about that?

Once again thanks for the reply.I will be using Swing Utilities method when i am using java 1.6.

Best Regards
Ganesh M

Be-careful while implenting document.insertString with respect to multiple threads. Their is chances UI may hang. so always prefer using SwingUtilities method and do above operations
9 years ago
This operations will work if the file test.txt is already created. Since both are not phyiscally created. Only virtually file path are calculated. Hence File rename operation is failed.

System.out.println(f1.renameTo(new File("C:/test1.txt"))); will always returns false.

Due to this you are getting same value.

1.Todo this first create a file using FileWriter/FileOutputStream . or an existing created
2. Then apply the operation.

9 years ago

Priya Lavti wrote:yes, I am doing the same.
But even then the dialog appears on top of parent window after selecting the parent window.

The JDiaog window is still shown on top of parent window but is inactive state (i.e. not selected/focused). It hinders the view of parent window when doing any operation on parent window.

provide the code
9 years ago