下面列出了怎么用javax.swing.LayoutFocusTraversalPolicy的API类实例代码及写法,或者点击链接到github查看源代码。
protected void populate() {
if (isDisposed()) { return; }
if (!populated) {
populated = true;
frame = SWT_AWT.new_Frame(this);
EventQueue.invokeLater(() -> {
applet = new JApplet();
if (PlatformHelper.isWindows()) {
applet.setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
}
frame.add(applet);
final Java2DDisplaySurface surface = createSwingComponent();
applet.getRootPane().getContentPane().add(surface);
WorkaroundForIssue2476.installOn(applet, surface);
WorkbenchHelper.asyncRun(() -> SwingControl.this.getParent().layout(true, true));
});
}
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
AffineTransform defaultTransform =
getGraphicsConfiguration().getDefaultTransform();
scaleFactorX = defaultTransform.getScaleX();
scaleFactorY = defaultTransform.getScaleY();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0,
(int)Math.round(bbImage.getWidth() / scaleFactorX),
(int)Math.round(bbImage.getHeight() / scaleFactorY)));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
AffineTransform defaultTransform =
getGraphicsConfiguration().getDefaultTransform();
scaleFactorX = defaultTransform.getScaleX();
scaleFactorY = defaultTransform.getScaleY();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0,
(int)Math.round(bbImage.getWidth() / scaleFactorX),
(int)Math.round(bbImage.getHeight() / scaleFactorY)));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
void createToolWindowContent(ToolWindow toolWindow) {
// Create runner UI layout
RunnerLayoutUi.Factory factory = RunnerLayoutUi.Factory.getInstance(project);
RunnerLayoutUi layoutUi = factory.create("", "", "session", project);
layoutUi.getOptions().setMoveToGridActionEnabled(false).setMinimizeActionEnabled(false);
Content console =
layoutUi.createContent(
BlazeConsoleToolWindowFactory.ID, consoleView.getComponent(), "", null, null);
console.setCloseable(false);
layoutUi.addContent(console, 0, PlaceInGrid.right, false);
// Adding actions
DefaultActionGroup group = new DefaultActionGroup();
layoutUi.getOptions().setLeftToolbar(group, TOOLBAR_ACTION_PLACE);
// Initializing prev and next occurrences actions
OccurenceNavigator navigator = fromConsoleView(consoleView);
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
AnAction prevAction = actionsManager.createPrevOccurenceAction(navigator);
prevAction.getTemplatePresentation().setText(navigator.getPreviousOccurenceActionName());
AnAction nextAction = actionsManager.createNextOccurenceAction(navigator);
nextAction.getTemplatePresentation().setText(navigator.getNextOccurenceActionName());
group.addAll(prevAction, nextAction);
AnAction[] consoleActions = consoleView.createConsoleActions();
for (AnAction action : consoleActions) {
if (!shouldIgnoreAction(action)) {
group.add(action);
}
}
group.add(new StopAction());
JComponent layoutComponent = layoutUi.getComponent();
layoutComponent.setFocusTraversalPolicyProvider(true);
layoutComponent.setFocusTraversalPolicy(
new LayoutFocusTraversalPolicy() {
@Override
public Component getDefaultComponent(Container container) {
if (container.equals(layoutComponent)) {
return consoleView.getPreferredFocusableComponent();
}
return super.getDefaultComponent(container);
}
});
Content content =
ContentFactory.SERVICE.getInstance().createContent(layoutComponent, null, true);
content.setCloseable(false);
toolWindow.getContentManager().addContent(content);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
/**
* Constructs a new, initially invisible {@code JLightweightFrame}
* instance.
*/
public JLightweightFrame() {
super();
copyBufferEnabled = "true".equals(AccessController.
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
add(rootPane, BorderLayout.CENTER);
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
if (getGraphicsConfiguration().isTranslucencyCapable()) {
setBackground(new Color(0, 0, 0, 0));
}
layoutSizeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
Dimension d = (Dimension)e.getNewValue();
if ("preferredSize".equals(e.getPropertyName())) {
content.preferredSizeChanged(d.width, d.height);
} else if ("maximumSize".equals(e.getPropertyName())) {
content.maximumSizeChanged(d.width, d.height);
} else if ("minimumSize".equals(e.getPropertyName())) {
content.minimumSizeChanged(d.width, d.height);
}
}
};
repaintListener = (JComponent c, int x, int y, int w, int h) -> {
Window jlf = SwingUtilities.getWindowAncestor(c);
if (jlf != JLightweightFrame.this) {
return;
}
Point p = SwingUtilities.convertPoint(c, x, y, jlf);
Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
bbImage.getHeight() / scaleFactor));
if (!r.isEmpty()) {
notifyImageUpdated(r.x, r.y, r.width, r.height);
}
};
SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
RepaintManager.currentManager(this), repaintListener);
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}
public static void main(String[] args) {
SwingFrame f0 = new SwingFrame("frame0");
f0.setVisible(true);
InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);
SwingFrame f1 = new SwingFrame("frame1");
f1.setVisible(true);
InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);
System.out.println("Test passed.");
}