Java 类javax.swing.plaf.LayerUI 实例源码
项目:OpenJSharp
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:jdk8u-jdk
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:openjdk-jdk10
文件:JLayer.java
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField f = s.readFields();
view = (V) f.get("view", null);
glassPane = (JPanel) f.get("glassPane", null);
eventMask = f.get("eventMask", 0l);
if (eventMask != 0) {
eventController.updateAWTEventListener(0, eventMask);
}
LayerUI<V> newLayerUI = (LayerUI<V>) f.get("layerUI", null);
if (newLayerUI != null) {
setUI(newLayerUI);
}
}
项目:openjdk-jdk10
文件:JLayer.java
@SuppressWarnings({"unchecked", "rawtypes"})
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI<?> ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:openjdk9
文件:JLayer.java
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField f = s.readFields();
view = (V) f.get("view", null);
glassPane = (JPanel) f.get("glassPane", null);
eventMask = f.get("eventMask", 0l);
if (eventMask != 0) {
eventController.updateAWTEventListener(0, eventMask);
}
LayerUI<V> newLayerUI = (LayerUI<V>) f.get("layerUI", null);
if (newLayerUI != null) {
setUI(newLayerUI);
}
}
项目:openjdk9
文件:JLayer.java
@SuppressWarnings({"unchecked", "rawtypes"})
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI<?> ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:Java8CN
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:jdk8u_jdk
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:lookaside_java-1.8.0-openjdk
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:iSeleda
文件:OutputSettingsPanel.java
private void addAnimationLengthSelector(LayerUI<JTextField> tfLayerUI, GridBagHelper gbHelper) {
gbHelper.addLabelWithControl("Number of Seconds:",
new JLayer<>(nrSecondsTF, tfLayerUI));
KeyListener keyListener = new KeyAdapter() {
@Override
public void keyReleased(KeyEvent keyEvent) {
updateCalculations();
}
};
nrSecondsTF.addKeyListener(keyListener);
gbHelper.addLabelWithControl("Frames per Second:",
new JLayer<>(fpsTF, tfLayerUI));
fpsTF.addKeyListener(keyListener);
nrFramesLabel = new JLabel();
updateCalculations();
gbHelper.addLabelWithControl("Number of Frames:", nrFramesLabel);
}
项目:infobip-open-jdk-8
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:jdk8u-dev-jdk
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:jdk7-jdk
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:openjdk-source-code-learn
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:OLD-OpenJDK8
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:openjdk-jdk7u-jdk
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:openjdk-icedtea7
文件:JLayer.java
@SuppressWarnings("unchecked")
public void eventDispatched(AWTEvent event) {
Object source = event.getSource();
if (source instanceof Component) {
Component component = (Component) source;
while (component != null) {
if (component instanceof JLayer) {
JLayer l = (JLayer) component;
LayerUI ui = l.getUI();
if (ui != null &&
isEventEnabled(l.getLayerEventMask(), event.getID()) &&
(!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
ui.eventDispatched(event, l);
}
}
component = component.getParent();
}
}
}
项目:jdk8u-jdk
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:jdk8u-jdk
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:openjdk-jdk10
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:openjdk9
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:jdk8u_jdk
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:jdk8u_jdk
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:lookaside_java-1.8.0-openjdk
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:lookaside_java-1.8.0-openjdk
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:iSeleda
文件:OutputSettingsPanel.java
public OutputSettingsPanel() {
super(new GridBagLayout());
// A single TFValidationLayerUI for all the textfields.
LayerUI<JTextField> tfLayerUI = new TFValidationLayerUI(this);
GridBagHelper gbHelper = new GridBagHelper(this);
addOutputTypeSelector(gbHelper);
addAnimationLengthSelector(tfLayerUI, gbHelper);
addInterpolationSelector(gbHelper);
addPingPongSelector(gbHelper);
addFileSelector(tfLayerUI, gbHelper);
}
项目:iSeleda
文件:OutputSettingsPanel.java
private void addFileSelector(LayerUI<JTextField> tfLayerUI, GridBagHelper gbHelper) {
JPanel filePanel = new JPanel(new FlowLayout());
filePanel.setBorder(BorderFactory.createTitledBorder("Output File/Folder"));
fileNameTF = browseFilesSupport.getNameTF();
filePanel.add(new JLayer<>(fileNameTF, tfLayerUI));
filePanel.add(browseFilesSupport.getBrowseButton());
gbHelper.addOnlyControlToRow(filePanel, 6);
}
项目:mars-sim
文件:Diva.java
public static void createUI() {
JFrame f = new JFrame ("Diva");
LayerUI<JPanel> layerUI = new SpotlightLayerUI();
JPanel panel = createPanel();
JLayer<JPanel> jlayer = new JLayer<JPanel>(panel, layerUI);
f.add (jlayer);
f.setSize(300, 200);
f.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
f.setLocationRelativeTo (null);
f.setVisible (true);
}
项目:infobip-open-jdk-8
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:infobip-open-jdk-8
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:jdk8u-dev-jdk
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:jdk8u-dev-jdk
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:jdk7-jdk
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:openjdk-source-code-learn
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:OLD-OpenJDK8
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:OLD-OpenJDK8
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:JAVA_UNIT
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:openjdk-jdk7u-jdk
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}
项目:openjdk-jdk7u-jdk
文件:bug7068740.java
bug7068740() {
super();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
DefaultTableModel model = new DefaultTableModel() {
@Override
public int getRowCount() {
return 20;
}
@Override
public int getColumnCount() {
return 2;
}
@Override
public Object getValueAt(int row, int column) {
return "(" + row + "," + column + ")";
}
};
table = new JTable(model);
table.setRowSelectionInterval(0, 0);
LayerUI<JComponent> layerUI = new LayerUI<>();
JLayer<JComponent> layer = new JLayer<>(table, layerUI);
JScrollPane scrollPane = new JScrollPane(layer);
add(scrollPane);
pack();
setLocationRelativeTo(null);
}
项目:openjdk-icedtea7
文件:bug6824395.java
public static void main(String[] args) throws Exception {
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
JFrame frame = new JFrame("testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
String str = "hello\n";
for(int i = 0; i<5; i++) {
str += str;
}
editorPane.setText(str);
JLayer<JEditorPane> editorPaneLayer = new JLayer<JEditorPane>(editorPane);
LayerUI<JComponent> layerUI = new LayerUI<JComponent>();
editorPaneLayer.setUI(layerUI);
scrollPane = new JScrollPane(editorPaneLayer);
scrollPane.setPreferredSize(new Dimension(200, 250));
frame.add(scrollPane);
frame.setSize(200, 200);
frame.pack();
frame.setVisible(true);
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
throw new RuntimeException("Wrong component's width!");
}
}
});
}