accessibilitydemo7.java
来自「java 完全探索的随书源码」· Java 代码 · 共 72 行
JAVA
72 行
// AccessibilityDemo7.java
import javax.accessibility.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class AccessibilityDemo7 extends JFrame
{
AccessibilityDemo7 (String title)
{
super (title);
addWindowListener (new WindowAdapter ()
{
public void windowClosing (WindowEvent e)
{
System.exit (0);
}
});
JPanel p = new JPanel ();
p.setPreferredSize (new Dimension (200, 200));
JTable jt = new JTable (10, 3);
p.add (jt);
getContentPane ().add (p);
pack ();
setVisible (true);
}
public static void main (String [] args)
{
AccessibilityDemo7 ad7;
ad7 = new AccessibilityDemo7 ("Accessibility Demo7");
try
{
Thread.sleep (5000);
}
catch (InterruptedException e) {}
ad7.dumpTableInfo (ad7.getAccessibleContext ());
}
void dumpTableInfo (AccessibleContext ac)
{
AccessibleTable at = ac.getAccessibleTable ();
if (at != null)
{
int nCol = at.getAccessibleColumnCount ();
System.out.println ("Columns = " + nCol);
int nRow = at.getAccessibleRowCount ();
System.out.println ("Rows = " + nRow);
return;
}
int nChildren = ac.getAccessibleChildrenCount ();
for (int i = 0; i < nChildren; i++)
dumpTableInfo (ac.getAccessibleChild (i)
.getAccessibleContext ());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?