如何点击单选按扭输出相应的话?
如上。 比如我打算点一下单选按扭然后输出一句话。一共4个按扭,比如按下a键输出“你好”,按下b键输出“再见”等等。应该如何弄?
用vb 或 delphi吧 太简单了 1、建个工程 2、建个窗体或表单 3、拉上几个按钮,分别命名 4、双击各个按钮,并生成的函数段中加入代码: 以 vb为例。 private sub command1_click() textbox1.text = "哈哈,文字输出其不意" ' 输出到文本框 debug.print "哈哈,文字输出" ' 输出到调试栏 ? " 哈哈" ' 输出到窗体表单 end sub 5、其它类推。 够明白了吧。
将下列内容保存成.html文件,打开浏览器看看: test a
b
c
d
function hello(){ var or=document.getElementsByName("ra1"); for(var i=0;i
package test; import t。BorderLayout; import javax。swing。JPanel; import javax。swing。JFrame; import javax。swing。JRadioButton; import javax。
swing。JDesktopPane; import t。Rectangle; import t。event。ActionListener; import javax。swing。JLabel; public class Test2 extends JFrame { private static final long serialVersionUID = 1L; private JPanel jContentPane = null; private JRadioButton[] jRadioButton = null; private JDesktopPane jDesktopPane = null; private JLabel jLabel = null; private int selectRadio = -1; public Test2() { super(); initialize(); } private void initialize() { tSize(300, 200); tContentPane(getJContentPane()); tTitle("JFrame"); } private JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new JPanel(); tLayout(new BorderLayout()); d(getJDesktopPane(), BorderLayout。
CENTER); } return jContentPane; } private JRadioButton[] getJRadioButton() { if (jRadioButton == null) { ActionListener listener = new MyListener(); jRadioButton = new JRadioButton[4]; for(int i = 0; i < 4; i++) jRadioButton[i] = new JRadioButton(); jRadioButton[0]。
setBounds(new Rectangle(30, 30, 50, 25)); jRadioButton[0]。setText("a"); jRadioButton[1]。setBounds(new Rectangle(100, 30, 50, 25)); jRadioButton[1]。
setText("b"); jRadioButton[2]。setBounds(new Rectangle(30, 100, 50, 25)); jRadioButton[2]。setText("c"); jRadioButton[3]。
setBounds(new Rectangle(100, 100, 50, 25)); jRadioButton[3]。setText("d"); for(int i = 0; i < 4; i++) jRadioButton[i]。
addActionListener(listener); } return jRadioButton; } private JDesktopPane getJDesktopPane() { if (jDesktopPane == null) { jLabel = new JLabel(); tBounds(new Rectangle(198, 63, 79, 40)); tText(""); jDesktopPane = new JDesktopPane(); d(jLabel, null); for(int i = 0; i < 4; i++) d(getJRadioButton()[i], null); } return jDesktopPane; } class MyListener implements ActionListener{ public void actionPerformed( t。
event。ActionEvent e) { if(selectRadio != -1) jRadioButton[selectRadio]。setSelected(false); for(int i = 0; i < 4; i++){ if(jRadioButton[i]。
isSelected()){ selectRadio = i; break; } } tText(jRadioButton[selectRadio]。getText()); } } public static void main(String[] args){ (new Test2())。
setVisible(true); } }。
答:就是手机的一种技术,和代码有关详情>>
答:所谓的网络编程,不论c还是java,本质上都是通过socket进行数据传输; 一般情况下可以使用的传输协议有tcp、udp、ftp等等,这些协议为网络变成提供基...详情>>