Here is a very simple JTable on a JFrame example that I extracted from another web site.
import javax.swing.*;
public class JTableSimpleSample {
JFrame f;
JTableSimpleSample(){
f=new JFrame();
String data[][]={ {"101","Amit","670000"},
{"102","Jai","780000"},
{"101","Sachin","700000"}};
String column[]={"ID","NAME","SALARY"};
JTable jt=new JTable(data,column);
jt.setBounds(30,40,200,300);
JScrollPane sp=new JScrollPane(jt);
f.add(sp);
f.setSize(300,400);
f.setVisible(true);
}
public static void main(String[] args) {
new JTableSimpleSample();
}
}
When resizing this window, the behavior is slightly different depending upon which edge is being used for resizing.
Top - resize the frame by clicking the top edge and it looks pretty clean except it does appear the bottom edge of the JFrame is continually getting repainted making it look like multiple lines exist.
Bottom - resize the frame by clicking the bottom edge looks pretty good as making it large shows a black area until the frame gets to repaint. Depending on how fast you resize the frame determines how much of the black area is visible.
Right - resize the frame by clicking the right edge is very similar to when the bottom edge is used when resizing.
Left - resize the frame by clicking the left edge looks terrible. It is no only similar to when it is resized using the top by showing multiple lines on the right edge, but at times the data itself looks a mess.
Using any of the corners results in a combination of 2 from any of the above scenarios.
Question/Objective : 1 - Why such different behavior?
2 - Is it possible to have it so that only an outline of the frame is shown when resizing and instead of a black background when resizing, have it transparent. Something like the following if the bottom right corner is used for resizing. The red lines are used to make it obvious as to the objective but it can very well remain black :
I did review Black outline while resizing JFrame but didn't fully understand the usage of the timer. Was not sure if there exists a property or if this would be managed via a mouse handler tied to the JFrame.