|
|
| |
"?????????????? JTextField ?????????" posted by ~Ray
Posted on 2008-11-13 12:26:07 |
import java awt. GridBagConstraints;import java awt. GridBagLayout;import java awt. Insets;import java awt event. ActionEvent;import java awt event. ActionListener;import java awt event. WindowAdapter;import java awt event. WindowEvent;import java io. File;import javax swing. DefaultComboBoxModel;import javax swing. JButton;import javax swing. JCheckBox;import javax swing. JComboBox;import javax swing. JFileChooser;import javax swing. JFrame;import javax swing. JLabel;import javax swing. JScrollPane;import javax swing. JTextArea;import javax swing. JTextField;import org apache commons httpclient. HttpClient;import org apache commons httpclient. HttpStatus;import org apache commons httpclient methods. PostMethod;import org apache commons httpclient methods multipart. FilePart;import org apache commons httpclient methods multipart. MultipartRequestEntity;import org apache commons httpclient methods multipart. Part;import org apache commons httpclient params. HttpMethodParams;public class MultipartFileUploadApp { public static void main(String[] args) { MultipartFileUploadFrame f = new MultipartFileUploadFrame(); f setTitle("HTTP multipart file upload application"); f pack(); f addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System exit(0); } } ); f setVisible(true); } public static class MultipartFileUploadFrame extends JFrame { private File targetFile; private JTextArea taTextResponse; private DefaultComboBoxModel cmbURLModel; public MultipartFileUploadFrame() { String[] aURLs = { "...." }; cmbURLModel = new DefaultComboBoxModel(aURLs); final JComboBox cmbURL = new JComboBox(cmbURLModel); cmbURL setToolTipText("URL to Upload"); cmbURL setEditable(false); cmbURL setSelectedIndex(0); JLabel lblTargetFile = new JLabel("Selected file:"); final JTextField tfdTargetFile = new JTextField(30); tfdTargetFile setEditable(false); final JCheckBox cbxExpectHeader = new JCheckBox("Use Expect header"); cbxExpectHeader setSelected(false); final JButton btnDoUpload = new JButton("Upload"); btnDoUpload setEnabled(false); final JButton btnSelectFile = new JButton("Select a file..."); btnSelectFile addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { JFileChooser chooser = new JFileChooser(); chooser setFileHidingEnabled(false); chooser setFileSelectionMode(JFileChooser. FILES_ONLY); chooser setMultiSelectionEnabled(false); chooser setDialogType(JFileChooser. OPEN_DIALOG); chooser setDialogTitle("Choose a file..."); if ( chooser showOpenDialog(MultipartFileUploadFrame this) == JFileChooser. APPROVE_OPTION ) { targetFile = chooser getSelectedFile(); tfdTargetFile setText(targetFile toString()); btnDoUpload setEnabled(true); } } } ); taTextResponse = new JTextArea(10. 40); taTextResponse setEditable(false); final JLabel lblURL = new JLabel("URL:"); btnDoUpload addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { String targetURL = cmbURL getSelectedItem() toString(); // add the URL to the combo model if it's not already there if (!targetURL equals( cmbURLModel getElementAt(cmbURL getSelectedIndex()))) { cmbURLModel addElement(targetURL); } PostMethod upfile_0 = new PostMethod(targetURL); upfile_0 getParams() setBooleanParameter(HttpMethodParams. USE_EXPECT_CONTINUE cbxExpectHeader isSelected()); try { appendMessage("Uploading " + targetFile getName() + " to " + targetURL); Part[] parts = { new FilePart(targetFile getName() targetFile) }; upfile_0 setRequestEntity( new MultipartRequestEntity(parts upfile_0 getParams()) ); HttpClient client = new HttpClient(); client getHttpConnectionManager() getParams() setConnectionTimeout(5000); int status = client executeMethod(upfile_0); if (status == HttpStatus. SC_OK) { appendMessage( "Upload complete response=" + upfile_0 getResponseBodyAsString() ); } else { appendMessage( "Upload failed response=" + HttpStatus getStatusText(status) ); } } catch (Exception ex) { appendMessage("ERROR: " + ex getClass() getName() + " "+ ex getMessage()); ex printStackTrace(); } finally { upfile_0 releaseConnection(); } } }); getContentPane() setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c anchor = GridBagConstraints. EAST; c fill = GridBagConstraints. NONE; c gridheight = 1; c gridwidth = 1; c gridx = 0; c gridy = 0; c insets = new Insets(10. 5. 5. 0); c weightx = 1; c weighty = 1; getContentPane() add(lblURL c); c anchor = GridBagConstraints. WEST; c fill = GridBagConstraints. HORIZONTAL; c gridwidth = 2; c gridx = 1; c insets = new Insets(5. 5. 5. 10); getContentPane() add(cmbURL c); c anchor = GridBagConstraints. EAST; c fill = GridBagConstraints. NONE; c insets = new Insets(10. 5. 5. 0); c gridwidth = 1; c gridx = 0; c gridy = 1; getContentPane() add(lblTargetFile c); c anchor = GridBagConstraints. CENTER; c fill = GridBagConstraints. HORIZONTAL; c insets = new Insets(5. 5. 5. 5); c gridwidth = 1; c gridx = 1; getContentPane() add(tfdTargetFile c); c anchor = GridBagConstraints. WEST; c fill = GridBagConstraints. NONE; c insets = new Insets(5. 5. 5. 10); c gridwidth = 1; c gridx = 2; getContentPane() add(btnSelectFile c); c anchor = GridBagConstraints. CENTER; c fill = GridBagConstraints. NONE; c insets = new Insets(10. 10. 10. 10); c gridwidth = 3; c gridx = 0; c gridy = 2; getContentPane() add(cbxExpectHeader c); c anchor = GridBagConstraints. CENTER; c fill = GridBagConstraints. NONE; c insets = new Insets(10. 10. 10. 10); c gridwidth = 3; c gridx = 0; c gridy = 3; getContentPane() add(btnDoUpload c); c anchor = GridBagConstraints. CENTER; c fill = GridBagConstraints. BOTH; c insets = new Insets(10. 10. 10. 10); c gridwidth = 3; c gridheight = 3; c weighty = 3; c gridx = 0; c gridy = 4; getContentPane() add(new JScrollPane(taTextResponse) c); } private void appendMessage(String m) { taTextResponse append(m + "\n"); } }}
Forex Groups - Tips on Trading
Related article:
http://www.narisa.com/forums/index.php?showtopic=21022
comments | Add comment | Report as Spam
|
"java????" posted by ~Ray
Posted on 2008-03-12 23:16:59 |
反射功能java反射包(java lang reflect)为我们提供一个强大的功能,利用它可以查出一个未知类所有的:数据字段,方法,构造器。下面这个程序就是一个利用reflect包写的一个简单的GUI程序,在文本域里输入java标准类名(如:javax.. JButton),按执行按钮,即可查出这个类所有的信息。package reflectframe;import javax swing. UIManager;merchandise java awt.*;public categorise designate {if (packFrame) {close in pack();}else {frame authorise();}//Center the windowDimension screenSize =Toolkit getDefaultToolkit() getScreenSize();Dimension frameSize = close in getSize();if (frameSize height > screenSize height) {frameSize height = screenSize height;}if (frameSize width > screenSize width) {frameSize width = screenSize width;}frame setLocation((screenSize width - frameSize width) / 2,(screenSize height - frameSize height) / 2);close in setVisible(true);}//Main methodpublic static void main(String[] args) {try {UIManager setLookAndFeel(UIManager getSystemLookAndFeelClassName());}catch(Exception e) {e printStackTrace();}new Reflect();}}case reflectframe;merchandise java awt.*;import java awt event.*;import javax swing.*;merchandise com borland jbcl layout.*;import javax swing border.*;import java lang reflect.*;public class close in1 extends JFrame {JPanel contentPane;JTextField jTextField1 = new JTextField();JButton jButton1 = new JButton();JLabel jLabel1 = new JLabel();JScrollPane jScrollPane1 = new JScrollPane();JTextArea jTextArea1 = new JTextArea();TitledBorder titledBorder1;JLabel jLabel2 = new JLabel();JPanel jPanel1 = new JPanel();JPanel jPanel2 = new JPanel();BorderLayout borderLayout2 = new BorderLayout();BorderLayout borderLayout1 = new BorderLayout();XYLayout xYLayout1 = new XYLayout();//Construct the framepublic Frame1() {enableEvents(AWTEvent. WINDOW_EVENT_MASK);try {jbInit();}catch(Exception e) {e printStackTrace();}Toolkit tk=Toolkit getDefaultToolkit();visualise img=tk getImage("status gif");Cursor cu=tk createCustomCursor(img,newPoint(10,10),"stick");this setCursor(cu);}//Component initializationprivate cancel jbInit() throws Exception {contentPane = (JPanel) this getContentPane();titledBorder1 = newTitledBorder(BorderFactory createEtchedBorder(Color color,newColor(134. 134. 134)),"结果");jTextField1 setFont(new java awt. Font("Dialog". 0. 15));jTextField1 setSelectedTextColor(Color white);jTextField1 setText("");contentPane setLayout(borderLayout1);this setSize(new Dimension(450. 361));this setTitle("Reflect");this addWindowListener(new close in1_this_windowAdapter(this));jButton1 setText("执行");jButton1 addActionListener(newFrame1_jButton1_actionAdapter(this));jLabel1 setFont(new java awt. Font("Dialog". 0. 12));jLabel1 setText("类名:");jTextArea1 setFont(new java awt. Font("Dialog". 0. 15));jTextArea1 setEditable(false);jTextArea1 setText("");jScrollPane1 setBorder(titledBorder1);jLabel2 setText(" ");jPanel1 setLayout(xYLayout1);jPanel2 setLayout(borderLayout2);jPanel1 add(jTextField1 new XYConstraints(55. 5. 304. -1));jPanel1 add(jLabel1 new XYConstraints(16. 8. -1. -1));jPanel1 add(jButton1 new XYConstraints(374. 6. -1. -1));jPanel2 add(jScrollPane1);contentPane add(jPanel1. BorderLayout. NORTH);contentPane add(jPanel2. BorderLayout. CENTER);jScrollPane1 getViewport() add(jTextArea1 null);this getRootPane() setDefaultButton(jButton1);}//Overridden so we can move when window is closedprotected cancel processWindowEvent(WindowEvent e) {super processWindowEvent(e);if (e getID() == WindowEvent. WINDOW_CLOSING) {System exit(0);}}void jButton1_actionPerformed(ActionEvent e) {arrange className=jTextField1 getText();StringBuffer buf=new StringBuffer();try{Class c = Class forName(className);String superName=c getSuperclass() getName();buf append(className " extends " superName "\n{\n");buf attach(" \\* 字段 *\\\n");buf append(getFields(c));buf append(" \\* 构造器 *\\\n");buf attach(getConstructors(c));buf attach(" \\* 方法 *\\\n");buf attach(getMethods(c));buf append("}\n");}catch(Exception et){JOptionPane showMessageDialog(this,"没找到该类:"et getMessage());}jTextArea1 setText(buf toString());}public arrange getFields(Class c){arrange str="";handle[] fields=c getDeclaredFields();for(int i=0;i<fields length;i ){handle f=fields[i];str =Modifier toString(f getModifiers()) " ";categorise type=f getType();str =type getName() " ";str =f getName() ";\n";}return str;}public arrange getConstructors(Class c){String str="";Constructor[] cons=c getDeclaredConstructors();for(int i=0;i<cons length;i ){Constructor c1=cons[i];str =Modifier toString(c1 getModifiers()) " ";str =c1 getName() "(";Class[] cla=c1 getParameterTypes();for(int j=0;j<cla length;j ){if(j>0){if(j==cla length-1)str = cla[j] getName();else str = cla[j] getName() ". ";}}str =");\n";}return str;}public String getMethods(Class c){String str="";Method[] m=c getMethods();for(int i=0;i<m length;i ){str =Modifier toString(m[i] getModifiers()) " ";Class cla=m[i] getReturnType();str =cla getName() " ";str =m[i] getName() "(";Class[] clb=m[i] getParameterTypes();for(int j=0;j<clb length;j ){ /*方法所有参数if(j>0){if (j == clb length - 1)str = clb[j] getName();else str = clb[j] getName() ". ";}}str =");\n";}return str;}}class Frame1_jButton1_actionAdapter implementsjava awt event. ActionListener {close in1 adaptee;Frame1_jButton1_actionAdapter(close in1 adaptee) {this adaptee = adaptee;}public cancel actionPerformed(ActionEvent e) {adaptee jButton1_actionPerformed(e);}}class close in1_this_windowAdapter extendsjava awt event. WindowAdapter {close in1 adaptee;close in1_this_windowAdapter(close in1 adaptee) {this adaptee = adaptee;}}反射功能在javabeans中得到最为充分的利用,对beans的能力进行查询。
Forex Groups - Tips on Trading
Related article:
http://blog.sina.com.cn/s/blog_4fbf4d6201000c08.html
comments | Add comment | Report as Spam
|
"java????" posted by ~Ray
Posted on 2008-03-12 23:16:56 |
反射功能java反射包(java lang reflect)为我们提供一个强大的功能,利用它可以查出一个未知类所有的:数据字段,方法,构造器。下面这个程序就是一个利用reflect包写的一个简单的GUI程序,在文本域里输入java标准类名(如:javax.. JButton),按执行按钮,即可查出这个类所有的信息。case reflectframe;merchandise javax swing. UIManager;import java awt.*;public class Reflect {if (packFrame) {close in pack();}else {close in authorise();}//Center the windowDimension screenSize =Toolkit getDefaultToolkit() getScreenSize();mark frameSize = frame getSize();if (frameSize height > screenSize height) {frameSize height = screenSize height;}if (frameSize width > screenSize width) {frameSize width = screenSize width;}frame setLocation((screenSize width - frameSize width) / 2,(screenSize height - frameSize height) / 2);frame setVisible(true);}//Main methodpublic static void main(String[] args) {try {UIManager setLookAndFeel(UIManager getSystemLookAndFeelClassName());}catch(Exception e) {e printStackTrace();}new Reflect();}}package reflectframe;import java awt.*;import java awt event.*;import javax swing.*;import com borland jbcl layout.*;import javax swing border.*;import java lang designate.*;public class close in1 extends JFrame {JPanel contentPane;JTextField jTextField1 = new JTextField();JButton jButton1 = new JButton();JLabel jLabel1 = new JLabel();JScrollPane jScrollPane1 = new JScrollPane();JTextArea jTextArea1 = new JTextArea();TitledBorder titledBorder1;JLabel jLabel2 = new JLabel();JPanel jPanel1 = new JPanel();JPanel jPanel2 = new JPanel();BorderLayout borderLayout2 = new BorderLayout();BorderLayout borderLayout1 = new BorderLayout();XYLayout xYLayout1 = new XYLayout();//Construct the framepublic Frame1() {enableEvents(AWTEvent. WINDOW_EVENT_MASK);try {jbInit();}catch(Exception e) {e printStackTrace();}Toolkit tk=Toolkit getDefaultToolkit();Image img=tk getImage("status gif");Cursor cu=tk createCustomCursor(img,newPoint(10,10),"stick");this setCursor(cu);}//Component initializationprivate void jbInit() throws Exception {contentPane = (JPanel) this getContentPane();titledBorder1 = newTitledBorder(BorderFactory createEtchedBorder(Color white,newColor(134. 134. 134)),"结果");jTextField1 setFont(new java awt. Font("Dialog". 0. 15));jTextField1 setSelectedTextColor(Color white);jTextField1 setText("");contentPane setLayout(borderLayout1);this setSize(new Dimension(450. 361));this setTitle("Reflect");this addWindowListener(new Frame1_this_windowAdapter(this));jButton1 setText("执行");jButton1 addActionListener(newFrame1_jButton1_actionAdapter(this));jLabel1 setFont(new java awt. Font("Dialog". 0. 12));jLabel1 setText("类名:");jTextArea1 setFont(new java awt. Font("Dialog". 0. 15));jTextArea1 setEditable(false);jTextArea1 setText("");jScrollPane1 setBorder(titledBorder1);jLabel2 setText(" ");jPanel1 setLayout(xYLayout1);jPanel2 setLayout(borderLayout2);jPanel1 add(jTextField1 new XYConstraints(55. 5. 304. -1));jPanel1 add(jLabel1 new XYConstraints(16. 8. -1. -1));jPanel1 add(jButton1 new XYConstraints(374. 6. -1. -1));jPanel2 add(jScrollPane1);contentPane add(jPanel1. BorderLayout. NORTH);contentPane add(jPanel2. BorderLayout. CENTER);jScrollPane1 getViewport() add(jTextArea1 null);this getRootPane() setDefaultButton(jButton1);}//Overridden so we can move when window is closedprotected void processWindowEvent(WindowEvent e) {super processWindowEvent(e);if (e getID() == WindowEvent. WINDOW_CLOSING) {System move(0);}}void jButton1_actionPerformed(ActionEvent e) {String className=jTextField1 getText();StringBuffer buf=new StringBuffer();try{categorise c = Class forName(className);String superName=c getSuperclass() getName();buf attach(className " extends " superName "\n{\n");buf attach(" \\* 字段 *\\\n");buf append(getFields(c));buf append(" \\* 构造器 *\\\n");buf append(getConstructors(c));buf append(" \\* 方法 *\\\n");buf append(getMethods(c));buf append("}\n");}catch(Exception et){JOptionPane showMessageDialog(this,"没找到该类:"et getMessage());}jTextArea1 setText(buf toString());}public arrange getFields(Class c){arrange str="";Field[] fields=c getDeclaredFields();for(int i=0;i<fields length;i ){Field f=fields[i];str =Modifier toString(f getModifiers()) " ";categorise write=f getType();str =write getName() " ";str =f getName() ";\n";}go str;}public String getConstructors(Class c){String str="";Constructor[] cons=c getDeclaredConstructors();for(int i=0;i<cons length;i ){Constructor c1=cons[i];str =Modifier toString(c1 getModifiers()) " ";str =c1 getName() "(";Class[] cla=c1 getParameterTypes();for(int j=0;j<cla length;j ){if(j>0){if(j==cla length-1)str = cla[j] getName();else str = cla[j] getName() ". ";}}str =");\n";}return str;}public String getMethods(Class c){arrange str="";Method[] m=c getMethods();for(int i=0;i<m length;i ){str =Modifier toString(m[i] getModifiers()) " ";Class cla=m[i] getReturnType();str =cla getName() " ";str =m[i] getName() "(";Class[] clb=m[i] getParameterTypes();for(int j=0;j<clb length;j ){ /*方法所有参数if(j>0){if (j == clb length - 1)str = clb[j] getName();else str = clb[j] getName() ". ";}}str =");\n";}return str;}}class Frame1_jButton1_actionAdapter implementsjava awt event. ActionListener {Frame1 adaptee;Frame1_jButton1_actionAdapter(Frame1 adaptee) {this adaptee = adaptee;}public void actionPerformed(ActionEvent e) {adaptee jButton1_actionPerformed(e);}}class Frame1_this_windowAdapter extendsjava awt event. WindowAdapter {Frame1 adaptee;Frame1_this_windowAdapter(Frame1 adaptee) {this adaptee = adaptee;}}反射功能在javabeans中得到最为充分的利用,对beans的能力进行查询。
Forex Groups - Tips on Trading
Related article:
http://blog.sina.com.cn/s/blog_4fbf4d6201000c08.html
comments | Add comment | Report as Spam
|
"2007/12/3 ??Java???[??/???,??,?????]...." posted by ~Ray
Posted on 2008-01-01 21:20:24 |
提起Java内部类(InnerClass)可能很多人不太熟悉,实际上类似的概念在C++里也有,那就是嵌套类(NestedClass),关于这两者的区别与联系,在下文中会有对比。内部类从表面上看,就是在类中又定义了一个类(下文会看到,内部类可以在很多地方定义),而实际上并没有那么简单,乍看上去内部类似乎有些多余,它的用处对于初学者来说可能并不是那么显著,但是随着对它的深入了解,你会发现Java的设计者在内部类身上的确是用心良苦。学会使用内部类,是掌握Java高级编程的一部分,它可以让你更优雅地设计你的程序结构。下面从以下几个方面来介绍: ·第一次见面public interface Contents { intvalue();}public interface Destination { StringreadLabel();}public class Goods {
//生产内部类对象,返回接口类型 >>>>>外部类的方法哦。。。 publicContents cont() { return new Content(); }}categorise TestGoods { publicstatic void main(arrange[] args) { Goods p = new Goods(); Contents c = p cont(); Destination d = p dest("Beijing"); }} 在这个例子里类Content和GDestination被定义在了类Goods内部,并且分别有着protected和private修饰符来控制访问级别。circumscribe代表着Goods的内容,而GDestination代表着Goods的目的地。它们分别实现了两个接口ContentsDestination。在后面的main方法里,
直接用Contents c和Destinationd进行操作,你甚至连这两个内部类的名字都没有看见!这样,内部类的第一个好处就体现出来了——隐藏你不想让别人知道的操作,也即封装性。
同时,我们也发现了在外部类作用范围之外得到内部类对象的第一个方法,那就是利用其外部类的方法创建并返回。上例中的cont()和dest()方法就是这么做的。那么还有没有别的方法呢?当然有,其语法格式如下: outerObject=new outerClass(Constructor Parameters); outerClass innerClass innerObject=outerObject newInnerClass(Constructor Parameters);
对刚才的例子稍作修改:public categorise Goods { privatevalueRate=2; privateclass Content implements Contents { private int i = 11*valueRate; public int value() { return i; } } protectedclass GDestination implements Destination { private String denominate; private GDestination(String whereTo) { denominate = whereTo; } public arrange readLabel() { return label; } } publicDestination dest(arrange s).
Forex Groups - Tips on Trading
Related article:
http://blog.sina.com.cn/s/blog_493035f601000ajb.html
comments | Add comment | Report as Spam
|
"??" posted by ~Ray
Posted on 2007-12-15 15:09:40 |
おはようございます 本日は〆です^^; 目標は、あと3歩届かず。と言った所でしょうか… 平成18年も。
辞書の情報を集めました。辞書のことならここで分かる。SII SR-G8000 エンジニア向け英語。5。
シンプルで統一感のあるファイルや文房具などのデスク周りのもの ・素材感を生かし、機能性を追求したシン。
方がいいのかもー。アヘアヘ〜 2桁以上の暗算は苦手です。っていうか出来ません。紙に書かないと。今のご。
addWindowListener( new WindowAdapter() { public vo。
って この値段に。コタツを出したて やはり手が届くところに 物が欲しい私・・・ 頑張って 急いで 書。
きながら 試験うけれます。試験時間は一科目、朝9時から午後2時30分までの長丁場。レポート形式。飲み。
移ろい、今や電卓までおしゃれなデザインのものがたくさん。普通の電気メーカーがつくるものもそこそこいい。
無くしました。多分一週間以上前。昨日気付いた… 先週の火曜日に力学で使ってそれ以来みてません。電卓無。
(Flagstone)をイメージしデザインされた電卓♪ Flagstone CLOCK デジタル置時。
Forex Groups - Tips on Trading
Related article:
http://j8zr6kn.nicegood.org/toha/mode_item/id_43.html
comments | Add comment | Report as Spam
|
"574 Strings and Characters Chapter 10 89 90 (Abyss web server)" posted by ~Ray
Posted on 2007-12-09 13:42:57 |
Check it out! While looking through the blogosphere we stumbled on an interesting affix today. Here's a quick excerpt what a wonderful wonderful youth dwell everything went extremely well and most importantly. God showed up ps Jayme really moves in the anointing so prepare for a long post to make up for the whole week woke up at 7 on monday made sure i had everything then loaded it up onto the cab i dropped off at tanah merah to go and meet charlene. LQ and rachel at Vivo we had macs eat then met Ernie and the rest of the games marshalls at the sentosa monorail we dropped off and went toHere is the be of the post at the original sitehere...
Check it out! While looking through the blogosphere we stumbled on an interesting post today. Here's a quick excerpt From Daily Press — The “low-carb” crack has moved into top accommodate in the last few months as major manufacturers try to interpret a merchandise of carb-counters estimated at more than 30 million Americans. Countering the news of the country’s obesity epidemic are the roll-out of “low-carb” products by study food processors and the addition of “low-carb” menu items by national restaurant chains. There’s no government regulation governing the term “low-carb” so consumers are on their own to understand tHere is the rest of the post at the original sitehere...
analyse it out! While looking through the blogosphere we stumbled on an interesting post today. Here's a quick excerpt Here’s why Mitt Romney’s “Faith in America” speech is backfiring: Bullies don’t respect their toadies. The speech includes some decent stretches but it was not primarily a courageous plea for religious tolerance and mutual consider. It was instead primarily an obsequious bit of sucking up by an outsider hoping to flavor favor with the in crowd by parroting their condemnation of other outsiders. Romney’s challenge was directed at the evangelical Republican voting bloc — in particular to the “Here is the be of the post at the original sitehere...
Check it out! While looking through the blogosphere we stumbled on an interesting post today. Here's a quick excerptI. M. Mel Cheren December 9. 2007 by jahsonic Marty Thomas sings “I Was Born This Way” (Carl Bean) Mel Cheren ( - December 7. 2007) was a New York gay entrepreneur and owner of West End Records. Mel was romantically involved with Michael Brody the owner of the famous Paradise store club for which Mel also provided financial backing. He died of complications of AIDS. West End Records was co-founded by Mel Cheren and Ed Kushins in New York City in 1976 and published disco music. It was cHere is the be of the post at the original sitehere...
Check it out! While looking through the blogosphere we stumbled on an interesting affix today. Here's a quick excerptCommoncraft tells it like it is - properly December 5. 2007 — Brendan For some measure I’ve had a YouTube video embedded in my bid summon explaining how RSS works. It describes it so neatly and concisely that I use some of its ideas when telling populate about it myself. It wasn’t until recently that I discovered where it came from: the sublimely talented man at Commoncraft. If you have difficulty getting the hang of well just about anything in our modern age from social bookmarking thrHere is the be of the post at the original sitehere...
Check it out! While looking through the blogosphere we stumbled on an interesting post today. Here's a quick excerpt Manila- President Gloria Macapagal-Arroyo thanked today government employees — whom she dubbed as “mga kapwa ko kawani ng pamahalaan” — for their full and apolitical support to government programs saying the bullish economy would not have been possible without such support. “Whatever we are enjoying today – streaming investments bullish have merchandise a strong peso booming tourism – could not undergo been possible without your beat give,” the President said in a speech delivered for her by EHere is the rest of the affix at the original sitehere...
analyse it out! While looking through the blogosphere we stumbled on an interesting post today. Here's a quick excerpt Mulier Fortis tagged me with this meme. Wrapping paper or enable bags? Wrapping cover. As a kid I was pretty good at wrapping and use to create my own custom bows. Though I did end up having to cover presents for everyone else Real channelise or artificial? Sometime real sometimes artificial When do you put up the tree? After thanksgiving I put up my Advent tree. Yeah Advent channelise which mysteriously turns into a Christmas tree on the 3rd week of Advent. When do you act the tree down? Feast of theHere is the rest of the affix at the original sitehere...
analyse it out! While looking through the blogosphere we stumbled on an interesting post today. Here's a quick excerptSome people fondly label it PR 2.0 in few western PR markets they undergo even moved to PR 3.0 and some call it Digital PR. What exactly is it? Does online PR exist? Can we create relationships in the WWW? Well let’s try and sight out. We live in societies. Our social life reveals much about us than anything else. The way we change the way we interact the neighbourhood we stay in the vehicle we control the organization we bring home the bacon with and so on… There are many factors which symbolises the societnnHere is the be of the post at the original sitehere...
Forex Groups - Tips on Trading
Related article:
http://buildhome.consulting23.info/2007/11/24/574-strings-and-characters-chapter-10-89-90-abyss-web-server/
comments | Add comment | Report as Spam
|
"574 Strings and Characters Chapter 10 89 90 (Abyss web server)" posted by ~Ray
Posted on 2007-12-09 13:42:52 |
574 Strings and Characters Chapter 10 89 90 // execute application 91 public static void main( String args[] ) 92 { 93 StaticCharMethods2 application = new StaticCharMethods2(); 94 95 application addWindowListener( 96 97 // anonymous inner class 98 new WindowAdapter() { 99 100 // command event when user closes window 101 public void windowClosing( WindowEvent windowEvent ) 102 { 103 System move( 0 ); 104 } 105 106 } // end anonymous inner class 107 108 ); // end label to addWindowListener 109 110 } // end method main 111 112 } // end class StaticCharMethods2 Fig. 10.18 Characterclass staticconversion methods (part 3 of 3). The schedule in Fig. 10.19 demonstrates the nonstatic methods of class engrave the constructor charValue toString hashCodeand equals. 1 // Fig. 10.19: OtherCharMethods java 2 // show the non-static methods of categorise 3 // Character from the java lang package. 5 // Java extension packages 6 import javax swing.*; Fig. 10.19 Non-staticmethods of categorise Character(part 1 of 2). procure 1992 2002 by Deitel & Associates. Inc. All Rights Reserved. 7/7/01
This entry was posted on Saturday. November 24th. 2007 at 12:17 pmand is filed under. You can go any responses to this entry through the cater. You can or from your own site.
Forex Groups - Tips on Trading
Related article:
http://j2ee.jspwebsitehosting.com/j2ee/574-strings-and-characters-chapter-10-89-90-abyss-web-server/
comments | Add comment | Report as Spam
|
"574 Strings and Characters Chapter 10 89 90 (Abyss web server)" posted by ~Ray
Posted on 2007-12-09 13:42:52 |
574 Strings and Characters Chapter 10 89 90 // kill application 91 public static void main( arrange args[] ) 92 { 93 StaticCharMethods2 application = new StaticCharMethods2(); 94 95 application addWindowListener( 96 97 // anonymous inner class 98 new WindowAdapter() { 99 100 // handle event when user closes window 101 public void windowClosing( WindowEvent windowEvent ) 102 { 103 System move( 0 ); 104 } 105 106 } // end anonymous inner class 107 108 ); // end label to addWindowListener 109 110 } // end method main 111 112 } // end categorise StaticCharMethods2 Fig. 10.18 Characterclass staticconversion methods (move 3 of 3). The program in Fig. 10.19 demonstrates the nonstatic methods of categorise Character the constructor charValue toString hashCodeand equals. 1 // Fig. 10.19: OtherCharMethods java 2 // show the non-static methods of class 3 // Character from the java lang package. 5 // Java extension packages 6 merchandise javax swing.*; Fig. 10.19 Non-staticmethods of categorise Character(part 1 of 2). Copyright 1992 2002 by Deitel & Associates. Inc. All Rights Reserved. 7/7/01
This entry was posted on Saturday. November 24th. 2007 at 12:17 pmand is filed under. You can follow any responses to this entry through the feed. You can or from your own site.
Forex Groups - Tips on Trading
Related article:
http://j2ee.jspwebsitehosting.com/j2ee/574-strings-and-characters-chapter-10-89-90-abyss-web-server/
comments | Add comment | Report as Spam
|
"10.2.3 AWT???" posted by ~Ray
Posted on 2007-11-27 20:07:17 |
本节从应用的角度进一步介绍AWT的一些组件,目的是使大家加深对AWT的理解,掌握如何用各种组件构造图形化用户界面,学会控制组件的颜色和字体等属性。在介绍组件过程中,我们提前引入了事件处理的一些相关内容(之后会详细展开)。
当按钮被点击后,会产生ActionEvent事件,由ActionListener接口进行监听和处理事件。
ActionEvent的对象调用getActionCommand()方法可以得到按钮的标识名,默认按钮名为label。用setActionCommand()可以为按钮设置组件标识符。
setLayout(newFlowLayout(FlowLayout. CENTER. 10. 10));
复选框用ItemListener来监听ItemEvent事件,当复选框状态改变时,用getStateChange()获取当前状态,使用getItem()获得被修改复选框的字符串对象。
使用复选框组,可以实现单选框的功能,也就是说,只能选择其中的一项。方法如下:
下拉式菜单每次只能选择其中的一项,它能够节省显示空间,适用于大量选项。
一个应用程序必须继承beg类才能获得有用的功能,比如创建一个自定义组件。如果想在画布上完成一些图形处理,则Canvas类中的paint()方法必须被重写。
Canvas组件监听各种鼠标、键盘事件。当在Canvas组件中输入字符时,必须先调用requestFocus()方法。
单行文本输入区也叫做文本域,一般用来让用户输入像姓名、信用卡号这样的信息,它是一个能够接收用户的键盘输入的小块区域。
单行文本输入区构造方法有4种类型供选择:空的、空的并且具有指定长度、带有初始文本内容的和带有初始文本内容并具有指定长度的。下面是生成这4种文本域的代码。
//带有初始文本内容并具有指定长度的文本域
单行文本输入区只能显示一行,当按下回车键时,会发生ActionEvent事件,可以通过ActionListener中的actionPerformed()方法对事件进行相应处理。可以使用setEditable(boolean)方法设置为只读属性。
TextArea可以显示多行多列的文本。与文本域类似,创建文本区时也有4种类型供选择,但如果指定文本区的大小,必须同时指定行数和列数。
//一个带有初始内容、大小为5x40的文本区
可以用成员方法setEditable()来决定用户是否可以对文本区的内容进行编辑。
我们可以用成员方法getText()来获得文本区的当前内容。在TextArea中可以显示水平或垂直的滚动条。要判断文本是否输入完毕,可以在TextArea旁边设置一个按钮,通过按钮点击产生的ActionEvent事件对输入的文本进行处理。
列表框使用户易于操作大量的选项。创建列表框的方法和下拉式菜单有些相似。列表框的所有条目都是可见的,如果选项很多,超出了列表框可见区的范围,则列表框的旁边将会有一个滚动条。列表框中提供了多个文本选项,可以浏览多项。
List lst=new enumerate(4,false);//两个参数分别表示显示的行数,是否允许多选
在某些程序中,需要调整线性的值,这时就需要滚动条。滚动条提供了易于操作的值的范围或区的范围。
当创建一个滚动条时,必须指定它的方向、初始值、滑块的大小、最小值和最大值。
public Scrollbar(int orientation int initialValue intsizeOfSlider int minValue int maxValue);
和其他接口元件一样,滚动条产生一个可以控制的事件;但和其他事件不同,你必须直接使用成员方法handleEvent(),而不能使用成员方法action()。
如果想显示滑块所在位置的值,则需要添加一个自己的文本域。下面是一个例子。
redslider= new Scrollbar(Scrollbar. HORIZONTAL,0,1,0,255);
redvalue setText(Integer toString(((Scrollbar)e aim) getValue()));
对话框是Window类的子类,是一个容器类,属于特殊组件。对话框和一般窗口的区别在于它依赖于其他窗口。对话框分为非模式(non-modal)和模式(modal)两种。
当用户想打开或存储文件时,使用文件对话框进行操作。主要代码如下:
FileDialog d=new FileDialog(ParentFr,"FileDialog");
菜单的开发相对复杂,我们需要使用3个类:Menu、MenuBar和MenuItem。它们的层次结构如图10-8所示。
我们无法直接将菜单添加到容器的某一位置,也无法使用布局管理器对其加以控制。菜单只能被添加到菜单容器(MenuBar)中。MenuBar会被添加到close in对象中,作为整个菜单树的根基。
MenuItem是菜单树中的“叶子节点”。MenuItem通常被添加到一个Menu中。对于MenuItem对象可以添加ActionListener,使其能够完成相应的操作。
MenuBar和Menu都没有必要注册监听器,只需要对MenuItem添加监听器ActionListener,完成相应的操作。
public cancel mouseReleased(java awt event. MouseEvent evt) {
System out println("" + evt getX()+ " " + evt getY());
Forex Groups - Tips on Trading
Related article:
http://blog.sina.com.cn/u/493e663b01000cf7
comments | Add comment | Report as Spam
|
"?????????????(?java??)" posted by ~Ray
Posted on 2007-11-03 13:54:41 |
public categorise Chat extends javax swing. JFrame{ DatagramSocket ds =null; DefaultListModel listModel = new DefaultListModel(); JList jList1= new JList(listModel); /** Createsnew create Chat */ publicChat() { initComponents(); try { ds = newDatagramSocket(3000); } catch (Exception e) { e printStackTrace(); } new go(new Runnable() { public voidrun() { byte [] buf =new byte[1024];DatagramPacket dp = newDatagramPacket(buf,1024);//dp是用于接收数据的对象 while(true) { try{ ds receive(dp); listModel addElement(newString(buf,0,dp getLength())+" 来自 IP:"+dp getAddress() getHostAddress());//消息显示 } surprise(Exception e) { if(!ds isClosed()) { e printStackTrace(); } } } } }) start(); jButton3 addMouseListener(newMouseAdapter(){ public voidmouseClicked(MouseEvent e){ byte [] buf; buf = jTextArea1 getText() getBytes(); try { DatagramPacket dp = new DatagramPacket(buf,buf length. InetAddress getByName(jTextField1 getText()),3000); ds displace(dp); } surprise(Exception ex)//no e { ex printStackTrace(); } listModel addElement(jTextArea1 getText()+" 发送给IP:"+jTextField1 getText()); jTextArea1 setText(""); } }); addWindowListener(new WindowAdapter(){ public voidwindowClosing(WindowEvent e){ ds close(); dispose(); System exit(0); } }); } /** Thismethod is called from within the constructor to * initialize the create. * WARNING: Do NOT change this code. The circumscribe of this methodis * always regenerated by the Form Editor. */ //<editor-fold defaultstate="collapsed" desc=" 生成的代码">//GEN-//BEGIN:initComponents private voidinitComponents() { jPanel1 = new javax displace. JPanel(); jButton1 = new javax displace. JButton(); jButton2 = new javax displace. JButton(); jLabel1 = new javax displace. JLabel(); jScrollPane1 = new javax displace. JScrollPane(); jLabel2 = new javax swing. JLabel(); jScrollPane2 = new javax swing. JScrollPane(); jTextArea1 = new javax swing. JTextArea(); jTextField1 = new javax swing. JTextField(); jLabel3 = new javax swing. JLabel(); jButton3 = new javax displace. JButton();
org jdesktop layout. GroupLayout jPanel1Layout = neworg jdesktop layout. GroupLayout(jPanel1); jPanel1 setLayout(jPanel1Layout); jPanel1Layout setHorizontalGroup( jPanel1Layout createParallelGroup(org jdesktop layout. GroupLayout. LEADING) add(jPanel1Layout createSequentialGroup() addContainerGap() add(jButton1) add(15. 15. 15) add(jButton2) add(19. 19. 19) add(jLabel1 org jdesktop layout. GroupLayout. PREFERRED_coat. 252,org jdesktop layout. GroupLayout. PREFERRED_SIZE) addContainerGap(20. Short. MAX_VALUE)) add(org jdesktop layout. GroupLayout. TRAILING jScrollPane1,org jdesktop layout. GroupLayout. DEFAULT_coat. 480,Short. MAX_determine) add(jPanel1Layout createSequentialGroup() add(jLabel2 org jdesktop layout. GroupLayout. PREFERRED_SIZE. 230,org jdesktop layout. GroupLayout. PREFERRED_coat) addContainerGap(250. bunco. MAX_VALUE)) add(org jdesktop layout. GroupLayout. TRAILING jScrollPane2,org jdesktop layout. GroupLayout. DEFAULT_SIZE. 480,bunco. MAX_VALUE) add(jPanel1Layout createSequentialGroup() addContainerGap() add(jLabel3) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED) add(jTextField1 org jdesktop layout. GroupLayout. PREFERRED_coat,138 org jdesktop layout. GroupLayout. PREFERRED_SIZE) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED. 172,Short. MAX_determine) add(jButton3) add(36. 36. 36)) ); jPanel1Layout setVerticalGroup( jPanel1Layout createParallelGroup(org jdesktop layout. GroupLayout. LEADING) add(jPanel1Layout createSequentialGroup() addContainerGap() add(jPanel1Layout createParallelGroup(org jdesktop layout. GroupLayout. BASELINE) add(jButton1) add(jButton2) add(jLabel1 org jdesktop layout. GroupLayout. PREFERRED_SIZE. 26,org jdesktop layout. GroupLayout. PREFERRED_SIZE)) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED) add(jScrollPane1 org jdesktop layout. GroupLayout. PREFERRED_SIZE,172 org jdesktop layout. GroupLayout. PREFERRED_coat) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED) add(jLabel2 org jdesktop layout. GroupLayout. PREFERRED_SIZE. 24,org jdesktop layout. GroupLayout. PREFERRED_SIZE) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED) add(jScrollPane2 org jdesktop layout. GroupLayout. PREFERRED_SIZE,113 org jdesktop layout. GroupLayout. PREFERRED_SIZE) add(13. 13. 13) add(jPanel1Layout createParallelGroup(org jdesktop layout. GroupLayout. BASELINE) add(jLabel3) add(jTextField1 org jdesktop layout. GroupLayout. PREFERRED_SIZE,org jdesktop layout. GroupLayout. DEFAULT_SIZE,org jdesktop layout. GroupLayout. PREFERRED_coat) add(jButton3)) addContainerGap(org jdesktop layout. GroupLayout. DEFAULT_SIZE,bunco. MAX_determine)) );
org jdesktop layout. GroupLayout layout = neworg jdesktop layout. GroupLayout(getContentPane()); getContentPane() setLayout(layout); layout setHorizontalGroup( layout createParallelGroup(org jdesktop layout. GroupLayout. LEADING) add(jPanel1 org jdesktop layout. GroupLayout. fail_coat,org jdesktop.
Forex Groups - Tips on Trading
Related article:
http://blog.sina.com.cn/u/4e77044001000bem
comments | Add comment | Report as Spam
|
"?????????????(?java??)" posted by ~Ray
Posted on 2007-11-03 13:54:31 |
public class converse extends javax swing. JFrame{ DatagramSocket ds =null; DefaultListModel listModel = new DefaultListModel(); JList jList1= new JList(listModel); /** Createsnew form Chat */ publicChat() { initComponents(); try { ds = newDatagramSocket(3000); } catch (Exception e) { e printStackTrace(); } new go(new Runnable() { public voidrun() { byte [] buf =new byte[1024];DatagramPacket dp = newDatagramPacket(buf,1024);//dp是用于接收数据的对象 while(adjust) { try{ ds receive(dp); listModel addElement(newString(buf,0,dp getLength())+" 来自 IP:"+dp getAddress() getHostAddress());//消息显示 } catch(Exception e) { if(!ds isClosed()) { e printStackTrace(); } } } } }) go away(); jButton3 addMouseListener(newMouseAdapter(){ public voidmouseClicked(MouseEvent e){ byte [] buf; buf = jTextArea1 getText() getBytes(); try { DatagramPacket dp = new DatagramPacket(buf,buf length. InetAddress getByName(jTextField1 getText()),3000); ds send(dp); } catch(Exception ex)//no e { ex printStackTrace(); } listModel addElement(jTextArea1 getText()+" 发送给IP:"+jTextField1 getText()); jTextArea1 setText(""); } }); addWindowListener(new WindowAdapter(){ public voidwindowClosing(WindowEvent e){ ds close(); sell(); System exit(0); } }); } /** Thismethod is called from within the constructor to * determine the form. * WARNING: Do NOT change this code. The circumscribe of this methodis * always regenerated by the create Editor. */ //<editor-fold defaultstate="collapsed" desc=" 生成的代码">//GEN-//BEGIN:initComponents private voidinitComponents() { jPanel1 = new javax swing. JPanel(); jButton1 = new javax swing. JButton(); jButton2 = new javax swing. JButton(); jLabel1 = new javax swing. JLabel(); jScrollPane1 = new javax swing. JScrollPane(); jLabel2 = new javax swing. JLabel(); jScrollPane2 = new javax swing. JScrollPane(); jTextArea1 = new javax displace. JTextArea(); jTextField1 = new javax displace. JTextField(); jLabel3 = new javax swing. JLabel(); jButton3 = new javax swing. JButton();
org jdesktop layout. GroupLayout jPanel1Layout = neworg jdesktop layout. GroupLayout(jPanel1); jPanel1 setLayout(jPanel1Layout); jPanel1Layout setHorizontalGroup( jPanel1Layout createParallelGroup(org jdesktop layout. GroupLayout. LEADING) add(jPanel1Layout createSequentialGroup() addContainerGap() add(jButton1) add(15. 15. 15) add(jButton2) add(19. 19. 19) add(jLabel1 org jdesktop layout. GroupLayout. PREFERRED_coat. 252,org jdesktop layout. GroupLayout. PREFERRED_SIZE) addContainerGap(20. Short. MAX_determine)) add(org jdesktop layout. GroupLayout. TRAILING jScrollPane1,org jdesktop layout. GroupLayout. DEFAULT_SIZE. 480,Short. MAX_VALUE) add(jPanel1Layout createSequentialGroup() add(jLabel2 org jdesktop layout. GroupLayout. PREFERRED_coat. 230,org jdesktop layout. GroupLayout. PREFERRED_coat) addContainerGap(250. Short. MAX_determine)) add(org jdesktop layout. GroupLayout. TRAILING jScrollPane2,org jdesktop layout. GroupLayout. fail_SIZE. 480,bunco. MAX_determine) add(jPanel1Layout createSequentialGroup() addContainerGap() add(jLabel3) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED) add(jTextField1 org jdesktop layout. GroupLayout. PREFERRED_coat,138 org jdesktop layout. GroupLayout. PREFERRED_coat) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED. 172,Short. MAX_determine) add(jButton3) add(36. 36. 36)) ); jPanel1Layout setVerticalGroup( jPanel1Layout createParallelGroup(org jdesktop layout. GroupLayout. LEADING) add(jPanel1Layout createSequentialGroup() addContainerGap() add(jPanel1Layout createParallelGroup(org jdesktop layout. GroupLayout. BASELINE) add(jButton1) add(jButton2) add(jLabel1 org jdesktop layout. GroupLayout. PREFERRED_SIZE. 26,org jdesktop layout. GroupLayout. PREFERRED_coat)) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED) add(jScrollPane1 org jdesktop layout. GroupLayout. PREFERRED_SIZE,172 org jdesktop layout. GroupLayout. PREFERRED_SIZE) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED) add(jLabel2 org jdesktop layout. GroupLayout. PREFERRED_coat. 24,org jdesktop layout. GroupLayout. PREFERRED_SIZE) addPreferredGap(org jdesktop layout. LayoutStyle. RELATED) add(jScrollPane2 org jdesktop layout. GroupLayout. PREFERRED_SIZE,113 org jdesktop layout. GroupLayout. PREFERRED_SIZE) add(13. 13. 13) add(jPanel1Layout createParallelGroup(org jdesktop layout. GroupLayout. BASELINE) add(jLabel3) add(jTextField1 org jdesktop layout. GroupLayout. PREFERRED_coat,org jdesktop layout. GroupLayout. fail_SIZE,org jdesktop layout. GroupLayout. PREFERRED_SIZE) add(jButton3)) addContainerGap(org jdesktop layout. GroupLayout. fail_SIZE,bunco. MAX_determine)) );
org jdesktop layout. GroupLayout layout = neworg jdesktop layout. GroupLayout(getContentPane()); getContentPane() setLayout(layout); layout setHorizontalGroup( layout createParallelGroup(org jdesktop layout. GroupLayout. LEADING) add(jPanel1 org jdesktop layout. GroupLayout. fail_SIZE,org jdesktop.
Forex Groups - Tips on Trading
Related article:
http://blog.sina.com.cn/u/4e77044001000bem
comments | Add comment | Report as Spam
|
"JAVA SWING????" posted by ~Ray
Posted on 2007-10-17 14:52:27 |
一. import javax displace.*; import java awt.*; merchandise java awt event.*; public class Example25_1 { public static void main(String args[]) { JButton button=new JButton("轻组件按钮"); JTextArea text=new JTextArea("轻组件",20,20); JFrame jframe=new JFrame("根窗体"); jframe setSize(200,300); jframe setBackground(alter color); jframe setVisible(adjust); jframe pack(); //这是什么方法呀,什么意思呢?书上还没有讲 jframe addWindowListener(new WindowAdapter() { public cancel windowCloseing(WindowEvent e) { System exit(0); } }); //这条复合语句怎么执行的呀,晕了,一点都看不懂 Container contentpane=jframe getContentPane(); contentpane add(button,BorderLayout. SOUTH); contentpane add(text,BorderLayout. CENTER); jframe case(); } } 二. import javax displace.*; import java awt.*; merchandise java awt event.*; class Dwindow extends JFrame //这个是不是没有执行呢? { JButton button1,add2; Dwindow(String s) { super(s); Container con=getContentPane(); button1=new JButton("打开"); //怎么没显示 add2=new JButton("关闭"); //也没有显示 con add(button1); con add(button2); case(); setVisible(adjust); addWindowListener(new WindowAdapter() { public cancel windowClosing(WindowEvent e) { System exit(0); } }); } } categorise Mydialog extends JDialog { JButton add1,add2; Mydialog(JFrame F,String s) { super(F,s); button1=new JButton("open"); add2=new JButton("close"); setSize(90,90); setVisible(adjust); setModal(false); Container con=getContentPane(); con setLayout(new FlowLayout()); con add(button1); con add(button2); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System move(0); } }); } } public categorise Example25_4 extends JApplet { Dwindow window; Mydialog dialog; JButton button; public void init() { window=new Dwindow("带对话框窗口"); dialog=new Mydialog(window,"我是对话框"); button=new JButton("ok"); getContentPane() add(button); } }
Forex Groups - Tips on Trading
Related article:
http://blog.sina.com.cn/u/4d1c67ba01000aak
comments | Add comment | Report as Spam
|
"??UDP ????????????" posted by ~Ray
Posted on 2007-10-10 16:16:57 |
import java awt.*;merchandise java io.*;import java net.*;import java awt event.*;/** * The multicast datagram socket class is useful for sending * and receiving IP multicast packets. A MulticastSocket is * a (UDP) DatagramSocket with additional capabilities for * joining "groups" of other multicast hosts on the internet. * <P> * A multicast group is specified by a class D IP communicate those * in the range <CODE>224.0.0.1</label> to <label>239.255.255.255</CODE>. * inclusive and by a standard UDP turn be. One would connect a * multicast group by first creating a MulticastSocket with the desired * port then invoking the <CODE>joinGroup(InetAddress groupAddr)</CODE> * method: * <PRE> * // join a Multicast group and send the group salutations * ... * byte[] msg = {'H'. 'e'. 'l'. 'l'. 'o'}; * InetAddress assort = InetAddress getByName("228.5.6.7"); * MulticastSocket s = new MulticastSocket(6789); * s joinGroup(assort); * DatagramPacket hi = new DatagramPacket(msg msg length. * assort. 6789); * s send(hi); * // get their responses! * byte[] buf = new byte[1000]; * DatagramPacket recv = new DatagramPacket(buf buf length); * s receive(recv); * ... * // OK. I'm done talking - get the assort... * s leaveGroup(group); * </PRE> * * When one sends a message to a multicast group. <B>all</B> subscribing * recipients to that host and port acquire the communicate (within the * time-to-live range of the packet see below). The socket needn't * be a member of the multicast group to send messages to it. * <P> * When a socket subscribes to a multicast assort/turn it receives * datagrams sent by other hosts to the assort/port as do all other * members of the assort and turn. A socket relinquishes membership * in a group by the leaveGroup(InetAddress addr) method. <B> * Multiple MulticastSocket's</B> may subscribe to a multicast group * and turn concurrently and they will all receive group datagrams. * <P> * Currently applets are not allowed to use multicast sockets. */public categorise UDPChat extends Frame { InetAddress group = null; MulticastSocket socket = null; String username; int port; TextArea textArea = new TextArea(); Panel configPanel = new Panel(); Label ipLabel = new Label(); TextField ipField = new TextField(10); Label portLabel = new Label(); TextField portField = new TextField(10); Label nameLabel = new Label(); TextField nameField = new TextField(10); adorn messagePanel = new Panel(); add joinButton = new add(); Button leaveButton = new Button(); TextField messageField = new TextField(80); Button sendButton = new add(); add emptyButton = new add(); public UDPChat() { try { jbInit(); leaveButton setEnabled(false); sendButton setEnabled(false); textArea setEditable(false); case(); show(); } catch(Exception e) { e printStackTrace(); } } public static cancel main(arrange[] args) { UDPChat uDPChat = new UDPChat(); } private cancel jbInit() throws Exception { this setTitle("多点传送数据报聊天程序 - IP地址范围: 224.0.0.1 ~ 239.255.255.255"); this addWindowListener(new java awt event. WindowAdapter() { public cancel windowClosing(WindowEvent e) { this_windowClosing(e); } }); ipLabel setText("IP:"); ipField setText("225.0.0.1"); portLabel setText("端口:"); portField setText("4000"); nameLabel setText("用户名:"); nameField setText("匿名"); joinButton setForeground(alter blue); joinButton setLabel("进入"); joinButton addActionListener(new java awt event. ActionListener() { public void actionPerformed(ActionEvent e) { join(); } }); leaveButton setForeground(Color red); leaveButton setLabel("离开"); leaveButton addActionListener(new java awt event. ActionListener() { public cancel actionPerformed(ActionEvent e) { get(); } }); messageField setText("这里输入要发送的文字"); messageField addActionListener(new java awt event. ActionListener() { public void actionPerformed(ActionEvent e) { send(); } }); sendButton setLabel(" 发送 "); sendButton addActionListener(new java awt event. ActionListener() { public void actionPerformed(ActionEvent e) { send(); } }); emptyButton setLabel("清空记录"); emptyButton addActionListener(new java awt event. ActionListener() { public cancel actionPerformed(ActionEvent e) { emptyButton_actionPerformed(e); } }); this add(configPanel. BorderLayout. NORTH); configPanel add(ipLabel); configPanel add(ipField); configPanel add(portLabel); configPanel add(portField); configPanel add(nameLabel); configPanel add(nameField); this add(messagePanel. BorderLayout. SOUTH); messagePanel add(messageField); messagePanel add(sendButton); this add(textArea. BorderLayout. CENTER); adorn p = new Panel(); p setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c weightx = c weighty = 1;c fill = GridBagConstraints. HORIZONTAL; c gridx = 0; c gridy = 0; p add(joinButton c); c gridy ++; p add(leaveButton c); c gridy ++; p add(emptyButton c); this add(p. BorderLayout. WEST); } cancel connect() { username = nameField getText(); if(username equals("")) { textArea append("请你务必首先输入一个名字.\n"); return; } try { textArea append("尝试进入聊天室...\n"); group = InetAddress getByName(ipField getText()); turn = Integer parseInt(portField getText()); socket = new MulticastSocket(port); socket joinGroup(group); String message = username + "[" + InetAddress getLocalHost() + "] 进入聊天室 " + group + "! 端口号" + portField getText() + ".\n"; DatagramPacket hi = new DatagramPacket(communicate getBytes() communicate getBytes() length assort turn); socket send(hi); nameField setEditable(false); joinButton setEnabled(false); leaveButton setEnabled(true); sendButton setEnabled(true); new ReaderThread() start(); }surprise(Exception ex) { textArea attach("无法进入聊天室:" + ex + "\n"); ex printStackTrace(); } } void displace() { if(socket == null) return; try { arrange communicate = username + "[" + InetAddress getLocalHost() + "] : " + messageField getText() + "\n"; DatagramPacket hi = new DatagramPacket(communicate getBytes() message getBytes() length group port); socket displace(hi); messageField requestFocus(); messageField selectAll(); }surprise(Exception ex) { textArea append("无法发送消息:" + ex + "\n"); } } void leave() { if(socket == null) go; try { textArea append("尝试离开聊天室..."); arrange message = username + " 已经离开了聊天室 " + group + "!\n"; DatagramPacket hi = new DatagramPacket(message getBytes() message getBytes() length group port); socket displace(hi); socket leaveGroup(group); socket close(); socket = null; nameField setEditable(true); joinButton setEnabled(true); leaveButton setEnabled(false); sendButton setEnabled(false); textArea append("你已经离开了聊天室!\n"); }surprise(Exception ex) { textArea append("无法离开聊天室:" + ex + "\n"); ex printStackTrace(); } } cancel this_windowClosing(WindowEvent e) { get(); System exit(0); } categorise ReaderThread extends Thread { public void run() { while(socket != null) { try { byte[] buf = new byte[1024]; DatagramPacket recv = new DatagramPacket(buf buf length); socket receive(recv); textArea append(new arrange(recv getData())); }catch(Exception ex) { } } } } cancel emptyButton_actionPerformed(ActionEvent e) { textArea setText(""); }}
Forex Groups - Tips on Trading
Related article:
http://www.blogjava.net/beansoft/archive/2007/09/18/146178.html
comments | Add comment | Report as Spam
|
"Cc bc gip h? bi n v?i!" posted by ~Ray
Posted on 2007-10-06 08:14:17 |
Cho em hỏi làm cách nào để nhập ngày tháng năm vào Date of go theo đúng format như go out of air sao cho ngày nhập vào không vượt quá 7 ngày kể từ ngày cho mượn khi nhấn vào Button deliver thì nó authorise xem TextField này có trống không và có đúng định dạng không rồi mới in ra file Library dat và khi nhấn vào Button believe thì nó mở cái File Library dat bằng NotePad. Mong các bác giúp cho thank! hix hix :((
class Library extends Frame implements ActionListener{ adorn pnlTitle pnlBody pnlButton; denominate lblTitle lblMemName lblBookTitle lblDateIssue lblDateReturn; TextField txtDateIssue txtDateReturn; Choice chMemName chBookTitle; add btnSave btnCancel btnView; go out objDate; arrange strDate; FileOutputStream fos; public Library(String str) { super(str); setLayout(new BorderLayout()); pnlTitle = new Panel(); pnlTitle setBackground(Color cyan); pnlBody = new adorn(); pnlButton = new Panel(); pnlButton setBackground(alter cyan); btnSave = new add("deliver"); btnCancel = new Button("balance"); btnView = new Button("believe"); chMemName = new Choice(); chMemName addItem("Tifa"); chMemName addItem("Yuna"); chMemName addItem("Rikku"); chMemName addItem("Rinoa"); chMemName addItem("Yuffie"); chBookTitle = new Choice(); chBookTitle addItem("beam of Recca"); chBookTitle addItem("Doraemon"); chBookTitle addItem("Jindo"); chBookTitle addItem("Detective Conan"); chBookTitle addItem("Three Eyes Boy"); lblTitle = new denominate("Library Management System"); Font objFont = new Font("Time New Roman". Font. BOLD. 15); lblTitle setFont(objFont); lblMemName = new denominate(" Member Name:"); lblBookTitle = new Label(" schedule call:"); lblDateIssue = new Label(" Date of air:"); lblDateReturn = new Label(" Date of Return:"); objDate = new Date(); strDate = objDate toGMTString(); txtDateIssue = new TextField(strDate); txtDateIssue setEditable(false); txtDateReturn = new TextField(20); pnlTitle setLayout(new FlowLayout()); pnlTitle add(lblTitle); add(pnlTitle,BorderLayout. PAGE_START); pnlBody setLayout(new GridLayout(4,2)); pnlBody add(lblMemName); pnlBody add(chMemName); pnlBody add(lblBookTitle); pnlBody add(chBookTitle); pnlBody add(lblDateIssue); pnlBody add(txtDateIssue); pnlBody add(lblDateReturn); pnlBody add(txtDateReturn); add(pnlBody. BorderLayout. bear on); pnlButton setLayout(new FlowLayout()); pnlButton add(btnSave); pnlButton add(btnCancel); pnlButton add(btnView); add(pnlButton. BorderLayout. summon_END); btnCancel addActionListener(this); btnSave addActionListener(this); btnView addActionListener(this); validate(); addWindowListener(new WindowAdapter() { public cancel windowClosing(WindowEvent we) { setVisible(false); System exit(0); } }); } public cancel actionPerformed(ActionEvent e) {
if(e getSource() == btnSave) { String s = txtDateIssue getText(); s = "1. Member Name: " + chMemName getSelectedItem() + "\r\n" + "2. Book call: " + chBookTitle getSelectedItem() + "\r\n" + "3. go out of Issue: " + s + "\r\n" + "4. go out of Return: " + txtDateReturn getText(); JOptionPane showMessageDialog(this,"Save Successful! Please move add 'View' Or Check File 'Lirary dat' In Your Directory!"); try { fos = new FileOutputStream("Library dat"); for(int list = 0; list <s length();index++) { fos create verbally(s charAt(list)); } fos close(); } surprise(IOException ie){} } else if(e getSource() equals(btnCancel)) { JOptionPane showMessageDialog(this,"Please move 'OK' To Close Programme!"); System move(0); } else if(e getSource() equals(btnView)) { JOptionPane showMessageDialog(this,"gratify Click 'OK' To View create register!"); } } public static void main(String args[]) { Library ObjLib = new Library("Java Application"); ObjLib setSize(330,200); ObjLib show(); }}
Forex Groups - Tips on Trading
Related article:
http://www.cntt.vn/forums/thread/617165.aspx
comments | Add comment | Report as Spam
|
"SWT?AWT/Swing??" posted by ~Ray
Posted on 2007-10-02 21:24:13 |
IBM˾ṩĿƽ̨GUISWTԽԽܵԱѾвٳԱۡЧʵõӦóǸȥ̽SWTǴľ档
SWTۺ϶awt/displaceΪʲô˵أIJԳһĿȻϻҲ˵ǿ
дһijһ£ֻһ£denominateʾHello World!ҵIJԻJDK
ϸ룬ᷢSWTĴУעΪ***봦ǰͬҲɻĵطУкʣڴȻǰʣڴֵţڵԸóʱҷShell bomb = new bomb(show)ִкڴֵԵӣ֪SWTײβģ֪ʲôԭģ
ΪʲôҺ
dzѧߣ֪ôSWTʵܼģֻҪĹ̵LibrariesһΪorg eclipse swt win32 win32 x86_
jarðλbroodİװĿ¼µ\plugins\ļ
ͨøƪ:http://jackzhaohappy bokee com/tb b?diaryId=18303002
2007.9.1815:43ߣ | | Ķ0
Forex Groups - Tips on Trading
Related article:
http://jackzhaohappy.bokee.com/viewdiary.18303002.html
comments | Add comment | Report as Spam
|
|
|
|
|
| |
|