-
Bug
-
Resolution: Fixed
-
P4
-
7
FULL PRODUCT VERSION :
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b22)
Java HotSpot(TM) Client VM (build 11.0-b08, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
I tried to resize components for example: java.awt.TextField without success.
I set initial bounds of a TextField in a Panel with null Layout. Everything is ok. I tried to change bounds automatically and the component doesn't change the size.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Create an empty applet
- set null layout to applet container
- define textfield with bounds for example 10, 10, 50, 20
- add textfield to applet container
- show applet
- change bounds to 10, 10 , 2, 2 (through program logic)
- change bounds back to 10, 10, 50, 20 (through program logic)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
painted textield with "visible" bounds 10, 10 , 50, 20
ACTUAL -
invalid repainted textfield
bounds are 10, 10 , 50, 20 but I don't see the textfield on screen, as expected.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package jdk.test;
import java.applet.Applet;
import java.awt.Button;
import java.awt.Rectangle;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Simple setBounds and resize test
*
* @author JRx
*/
public class BugReportApplet extends Applet
implements ActionListener
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Members
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** default username bounds */
private static final Rectangle REC_USERNAME = new Rectangle(10, 10, 80, 20);
/** input username */
private TextField tfUsername;
/** test button */
private Button butResize;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Override
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Override
public void start()
{
}
@Override
public void stop()
{
}
@Override
public void init()
{
/* Username */
tfUsername = new TextField(10);
tfUsername.setBounds(BugReportApplet.REC_USERNAME);
butResize = new Button("Resize");
butResize.setBounds(10, 40, 50, 25);
butResize.addActionListener(this);
/* MAIN LAYOUT */
setLayout(null);
add(tfUsername);
add(butResize);
}
@Override
public void destroy()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Interfaces
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//ACTIONLISTENER
public void actionPerformed(ActionEvent ae)
{
Rectangle rec = tfUsername.getBounds();
if (rec.width < 10)
{
tfUsername.setBounds(BugReportApplet.REC_USERNAME);
}
else
{
tfUsername.setBounds(10, 10, 5, 5);
}
}
} //BugReportApplet
---------- END SOURCE ----------
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b22)
Java HotSpot(TM) Client VM (build 11.0-b08, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
I tried to resize components for example: java.awt.TextField without success.
I set initial bounds of a TextField in a Panel with null Layout. Everything is ok. I tried to change bounds automatically and the component doesn't change the size.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Create an empty applet
- set null layout to applet container
- define textfield with bounds for example 10, 10, 50, 20
- add textfield to applet container
- show applet
- change bounds to 10, 10 , 2, 2 (through program logic)
- change bounds back to 10, 10, 50, 20 (through program logic)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
painted textield with "visible" bounds 10, 10 , 50, 20
ACTUAL -
invalid repainted textfield
bounds are 10, 10 , 50, 20 but I don't see the textfield on screen, as expected.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package jdk.test;
import java.applet.Applet;
import java.awt.Button;
import java.awt.Rectangle;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Simple setBounds and resize test
*
* @author JRx
*/
public class BugReportApplet extends Applet
implements ActionListener
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Members
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/** default username bounds */
private static final Rectangle REC_USERNAME = new Rectangle(10, 10, 80, 20);
/** input username */
private TextField tfUsername;
/** test button */
private Button butResize;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Override
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@Override
public void start()
{
}
@Override
public void stop()
{
}
@Override
public void init()
{
/* Username */
tfUsername = new TextField(10);
tfUsername.setBounds(BugReportApplet.REC_USERNAME);
butResize = new Button("Resize");
butResize.setBounds(10, 40, 50, 25);
butResize.addActionListener(this);
/* MAIN LAYOUT */
setLayout(null);
add(tfUsername);
add(butResize);
}
@Override
public void destroy()
{
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Interfaces
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//ACTIONLISTENER
public void actionPerformed(ActionEvent ae)
{
Rectangle rec = tfUsername.getBounds();
if (rec.width < 10)
{
tfUsername.setBounds(BugReportApplet.REC_USERNAME);
}
else
{
tfUsername.setBounds(10, 10, 5, 5);
}
}
} //BugReportApplet
---------- END SOURCE ----------
- duplicates
-
JDK-6732996 VolIage not repainted properly when resizing the containing frame/canvas, Vista
- Closed
- relates to
-
JDK-2167756 Allow limited mixing of heavy and lightweight components
- Resolved
-
JDK-4811096 Allow limited mixing of heavy and lightweight components
- Closed
-
JDK-6682046 Mixing code does not always recalculate shapes correctly when resizing components
- Resolved
-
JDK-6689303 Resizing doesn't change the size of the content
- Closed