📄 accessibilitydemo3.java
字号:
// AccessibilityDemo3.java
import javax.accessibility.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class AccessibilityDemo3 extends JFrame
{
AccessibilityDemo3 (String title)
{
super (title);
addWindowListener (new WindowAdapter ()
{
public void windowClosing (WindowEvent e)
{
System.exit (0);
}
});
JPanel p = new JPanel ();
p.setPreferredSize (new Dimension (200, 50));
JButton jb = new JButton ("OK");
p.add (jb);
getContentPane ().add (p);
pack ();
setVisible (true);
}
public static void main (String [] args)
{
AccessibilityDemo3 ad3;
ad3 = new AccessibilityDemo3 ("Accessibility Demo3");
try
{
Thread.sleep (5000);
}
catch (InterruptedException e) {}
ad3.dumpComponentInfo (ad3.getAccessibleContext ());
}
void dumpComponentInfo (AccessibleContext ac)
{
AccessibleComponent ax = ac.getAccessibleComponent ();
if (ax != null)
{
String s = ac.getAccessibleName ();
if (s != null && s.equals ("OK"))
{
System.out.println ("Background color: " +
ax.getBackground ());
System.out.println ("Cursor: " +
ax.getCursor ());
Cursor c;
c = Cursor.getPredefinedCursor (Cursor.WAIT_CURSOR);
ax.setCursor (c);
System.out.println ("Foreground color: " +
ax.getForeground ());
System.out.println ("Location: " +
ax.getLocationOnScreen ());
}
}
int nChildren = ac.getAccessibleChildrenCount ();
for (int i = 0; i < nChildren; i++)
dumpComponentInfo (ac.getAccessibleChild (i)
.getAccessibleContext ());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -