1.java��ǰС����Դ��
2.JAVAå°ç¨åºââââå¾ç®å
3.java:求一个用swing来做小程序,当前a当我是小程序源用来修改配置文件用的,求代码谢谢
4.求java经典小程序代码
5.ç®åçjavaç¨åºä»£ç ï¼
java��ǰС����Դ��
// My car shop.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class carshop extends JFrame
{
// JPanel to hold all pictures
private JPanel windowJPanel;
private String[] cars = { "","阿斯顿马丁", "美洲虎", "凯迪拉克",
"罗孚", "劳斯莱斯","别克"};
private int[] jiage = { 0,, , ,
, , };
// JLabels for first snack shown
private JLabel oneJLabel;
private JLabel oneIconJLabel;
// JLabels for second snack shown
private JLabel twoJLabel;
private JLabel twoIconJLabel;
// JLabels for third snack shown
private JLabel threeJLabel;
private JLabel threeIconJLabel;
// JLabels for fourth snack shown
private JLabel fourJLabel;
private JLabel fourIconJLabel;
// JLabels for fifth snack shown
private JLabel fiveJLabel;
private JLabel fiveIconJLabel;
// JLabels for sixth snack shown
private JLabel sixJLabel;
private JLabel sixIconJLabel;
// JTextField for displaying snack price
private JTextArea displayJTextArea;
// JLabel and JTextField for user input
private JLabel inputJLabel;
private JComboBox selectCountryJComboBox;
private JLabel inputJLabel2;
private JTextField inputJTextField2;
// JButton to enter user input
private JButton enterJButton;
//JButton to clear the components
private JButton clearJButton;
// no-argument constructor
public carshop()
{
createUserInterface();
}
// create and position GUI components; register event handlers
private void createUserInterface()
{
// get content pane for attaching GUI components
Container contentPane = getContentPane();
// enable explicit positioning of GUI components
contentPane.setLayout( null );
// set up windowJPanel
windowJPanel = new JPanel();
windowJPanel.setBounds( , , , );
windowJPanel.setBorder( new LineBorder( Color.BLACK ) );
windowJPanel.setLayout( null );
contentPane.add( windowJPanel );
// set up oneIconJLabel
oneIconJLabel = new JLabel();
oneIconJLabel.setBounds( , , , );
oneIconJLabel.setIcon( new ImageIcon( "images/阿斯顿马丁.jpg" ) );
windowJPanel.add( oneIconJLabel );
// set up oneJLabel
oneJLabel = new JLabel();
oneJLabel.setBounds( , , , );
oneJLabel.setText( "阿斯顿马丁" );
oneJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( oneJLabel );
// set up twoIconJLabel
twoIconJLabel = new JLabel();
twoIconJLabel.setBounds( , , , );
twoIconJLabel.setIcon( new ImageIcon( "images/美洲虎.jpg" ) );
windowJPanel.add( twoIconJLabel );
// set up twoJLabel
twoJLabel = new JLabel();
twoJLabel.setBounds( , , , );
twoJLabel.setText( "美洲虎" );
twoJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( twoJLabel );
// set up threeIconJLabel
threeIconJLabel = new JLabel();
threeIconJLabel.setBounds( , , , );
threeIconJLabel.setIcon( new ImageIcon(
"images/凯迪拉克.jpg" ) );
windowJPanel.add( threeIconJLabel );
// set up threeJLabel
threeJLabel = new JLabel();
threeJLabel.setBounds( , , , );
threeJLabel.setText( "凯迪拉克" );
threeJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( threeJLabel );
// set up fourIconJLabel
fourIconJLabel = new JLabel();
fourIconJLabel.setBounds( , , , );
fourIconJLabel.setIcon( new ImageIcon( "images/罗孚.jpg" ) );
windowJPanel.add( fourIconJLabel );
// set up fourJLabel
fourJLabel = new JLabel();
fourJLabel.setBounds( , , , );
fourJLabel.setText( "罗孚" );
fourJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( fourJLabel );
// set up fiveIconJLabel
fiveIconJLabel = new JLabel();
fiveIconJLabel.setBounds( , , , );
fiveIconJLabel.setIcon( new ImageIcon(
"images/劳斯莱斯.jpg" ) );
windowJPanel.add( fiveIconJLabel );
// set up fiveJLabel
fiveJLabel = new JLabel();
fiveJLabel.setBounds( , , , );
fiveJLabel.setText( "劳斯莱斯" );
fiveJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( fiveJLabel );
// set up sixIconJLabel
sixIconJLabel = new JLabel();
sixIconJLabel.setBounds( , , , );
sixIconJLabel.setIcon( new ImageIcon( "images/别克.jpg" ) );
windowJPanel.add( sixIconJLabel );
// set up sixJLabel
sixJLabel = new JLabel();
sixJLabel.setBounds( , , , );
sixJLabel.setText( "别克" );
sixJLabel.setHorizontalAlignment( JLabel.CENTER );
windowJPanel.add( sixJLabel );
// set up enterJButton
enterJButton = new JButton();
enterJButton.setBounds( , , , );
enterJButton.setText( "Enter" );
contentPane.add( enterJButton );
enterJButton.addActionListener(
new ActionListener() // anonymous inner class
{
// event handler called when enterJButton is clicked
public void actionPerformed( ActionEvent event )
{
enterJButtonActionPerformed( event );
}
} // end anonymous inner class
); // end call to addActionListener
// set up clearJButton
clearJButton = new JButton();
clearJButton.setBounds( , , , );
clearJButton.setText( "Clear" );
contentPane.add( clearJButton );
// set up inputJLabel
inputJLabel = new JLabel();
inputJLabel.setBounds( , , , );
inputJLabel.setText( "Please make selection:" );
contentPane.add( inputJLabel );
selectCountryJComboBox = new JComboBox( cars );
selectCountryJComboBox.setBounds( , , , );
selectCountryJComboBox.setMaximumRowCount( 3 );
contentPane.add( selectCountryJComboBox );
// set up inputJTextField
inputJLabel2 = new JLabel();
inputJLabel2.setBounds( , , , );
inputJLabel2.setText( "Input the Numble:" );
contentPane.add( inputJLabel2 );
// set up inputJTextField
inputJTextField2 = new JTextField();
inputJTextField2.setBounds( , , , );
inputJTextField2.setHorizontalAlignment( JTextField.RIGHT );
contentPane.add( inputJTextField2 );
clearJButton.addActionListener(
new ActionListener() // anonymous inner class
{
// event handler called when clearJButton is clicked
public void actionPerformed( ActionEvent event )
{
clearJButtonActionPerformed( event );
}
} // end anonymous inner class
);
// set up displayJTextField
displayJTextArea = new JTextArea();
displayJTextArea.setBounds( , ,, );
displayJTextArea.setEditable( false );
contentPane.add( displayJTextArea );
// set properties of application's window
setTitle( "My car Shop" ); // set title bar string
setSize( , ); // set window size
setVisible( true ); // display window
} // end method createUserInterface
private void clearJButtonActionPerformed( ActionEvent event )
{
// clear the JTextFields
inputJTextField2.setText( "" );
displayJTextArea.setText("");
} // end method clearJButtonActionPerformed
private void enterJButtonActionPerformed( ActionEvent event )
{
double z;
double c;
int x;
int y;
x=selectCountryJComboBox.getSelectedIndex();
y=Integer.parseInt(inputJTextField2.getText());
double discountRate;
int amount = Integer.parseInt( inputJTextField2.getText());
switch (amount/5)
{
case 0:
discountRate = 0;
break;
case 1:
discountRate = 1;
break;
case 2:
discountRate = 2;
break;
case 3:
discountRate = 3;
break;
default:
discountRate = 4;
} // end switch statement
c=1-discountRate/;
z=jiage[x]*y*c;
displayJTextArea.append("你选择的是:"+cars[x]+";"+
"它的单价是:"+jiage[x]+";" +"你购买该产品的数量是:"+y+"," +"\n"+"该数量的源码折扣是:"
+discountRate + " %"+";"+"本次消费的总价格是:"+z+"元"+"!"+"\n");
}
public static void main( String args[] )
{
carshop application = new carshop();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
} // end method main
} // end class carshop
JAVAå°ç¨åºââââå¾ç®å
import javax.swing.*;
import java.awt.event.*;
public class TestFrame extends JFrame,implements ActionListner
{
public TestFrame()
{
JButton b = new JButton("exit");
b.addActionListener(this);
Container cp = this.getContentPane();
cp.add(b);
this.setSize(,);
this.setVisible(true);
}
public void actionPerformed(ActionEvent evt)
{
System.exit(0);
}
public static void main(String[] args)
{
new TestFrame();
}
}
java:求一个用swing来做小程序,我是当前a当抖音冲马桶源码用来修改配置文件用的,求代码谢谢
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class Test extends JFrame {
private JPanel jp = new JPanel();
private JButton jb = new JButton("按钮一");
private JButton jb = new JButton("按钮二");
private JButton jb = new JButton("按钮三");
private JButton[] jb = new JButton[] { jb,小程序源底部孕线公式源码 jb, jb };
private JLabel jl = new JLabel("请单击按钮!");
private int count = 0;
public Test() {
for (int i = 0; i < jb.length; i++) {
jp.add(jb[i]);
}
jp.add(jl);
this.add(jp);
this.setTitle("点按钮,程序记录单击按钮的源码次数和名字!");
jb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
Test.this.jl.setText(jl.getText());
}
});
for (int i = 0; i < jb.length; i++) {
jb[i].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if (e.getSource() == jb) {
Test.this.jl.setText("您单击的当前a当是按钮一,您总共单机了" + (++count)
+ "次按钮");
} else if (e.getSource() == jb) {
Test.this.jl.setText("您单击的小程序源是按钮二,您总共单机了" + (++count)
+ "次按钮");
} else if (e.getSource() == jb) {
Test.this.jl.setText("您单击的程序是按钮三,您总共单机了" + (++count)
+ "次按钮");
}
}
});
this.setBounds(,源码 , , );
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
public static void main(String[] args) {
new Test();
}
}
求java经典小程序代码
代码如下:public class HelloWorld {
public static void main(String []args) {
int a = 3, b = 7 ;
System.out.println("Hello World!");
}
public static int f(int a, int b){
return a*a + a*b + b*b;
}
}
结果如下:
ç®åçjavaç¨åºä»£ç ï¼
æéè¦ä¸æ®µæç®åçjava代ç ç¨åº
1ãæç®åçjava代ç è¯å®å°±æ¯è¿ä¸ªäºï¼å¦ä¸ï¼publicclassMyFirstApp{ publicstaticvoidmain(String[]args){ System.out.print(Helloworld)ï¼}}âhelloworldâå°±æ¯åºè¯¥æ¯ææå¦javaçæ°æçç第ä¸ä¸ªä»£ç äºã
2ãpublicclassHelloWorld{ publicstaticvoidmain(String[]args){ System.out.println(helloworldï¼)ï¼}}åºæ¬æ¦å¿µJavaæ¯ä¸ç§å¯ä»¥æ°å跨平å°åºç¨è½¯ä»¶çé¢å对象çç¨åºè®¾è®¡è¯è¨ã
3ãä¸é¢çç¨åºå¯ä»¥ç´æ¥éè¿ç¼è¯è¿è¡ï¼èªå·±å¯»æ¾è¦ç¨å°ç代ç 段ã
4ãæ¯å¦myeclipseï¼é£ä¹å°±æ¯å建ä¸ä¸ªç±»ï¼ç¶åæ²å ¥mainï¼alt+/å¯ä»¥å¯¼åºmainå½æ°ï¼Javaç¨åºçå ¥å£å°±æ¯mainï¼ãå¦æ没æç¨å·¥å ·ï¼éè¦é ç½®ç¯å¢åéçï¼é 置好ä¹åã
5ãææ³å¦ç¼åJAVAç¨åºï¼å¨å¦ä¹åæ¥äºè§£ä¸ãç¼åJAVAæ¶è¦å»ºç«åªå 个æ件夹ï¼è¯´ææ¯ä¸ªæ件夹çä½ç¨ï¼å¦ç¼åJAVAæ¯ä¸æ¯è±è¯ä¸å®è¦ä¼ï¼è¿æé£äºä»£ç æ¯ä¸æ¯è¦è®°ä½ï¼å¸®ææ¨è个ç¼åJAVAçå·¥å ·ï¼æ好æ¯å è´¹çã
javaç®åå°ç¨åºç¼å,å°±ä¸ç¹ç¹ä»é¶å¼å§å¦ä¹ Javaï¼ä¸å®è¦æ¯ä»åºç¡å 容è¿è¡å¦èµ·ï¼è¿ä¸ªä¹æ¯è¦å¨å¦ä¹ çæ¶åå¤å 注æï¼å 为ç°å¨æçå¹è®æºæ课ç¨å®æå ¶å®å¹¶ä¸æ¯ä»æåºç¡çå¼å§çã
å½ç¶ï¼è¿ä¹ä¸æ¯è®©ä½ æå ¨é¨çåºç¡ç¥è¯é½å¿ é¡»ææ¡ï¼ä½æ¯ï¼Javaçä¸äºåºæ¬çæ¦å¿µçè¿äºæ¯éè¦ä½ äºè§£çã
ç¨JAVAç¼åä¸ä¸ªé¶è¡ç³»ç»çå°ç¨åºï¼è¦æ±å¦å¾çæ示ï¼å¾ççä¸æ¸ å°±çæåå§ï¼å¯å¨è½¯ä»¶ï¼æå°æ¬¢è¿ä½¿ç¨ä¸æATMé¶è¡ç³»ç»ï¼å¹¶æ示è¾å ¥Rï¼æ³¨åï¼Lï¼ç»å½ï¼Qï¼éåºæ³¨åæµç¨å为ï¼ç¨æ·æ³¨åï¼å 许注åå¤ä¸ªç¨æ·ã
é£ä¹ï¼å®å¶çµåç½ç«åè½ï¼è´¹ç¨èªç¶ä¹å°±ä¼å¢å ï¼åè½éæ±è¶å¤ï¼åè½å®ç°é¾åº¦è¶é«ï¼éä¹çµåç½ç«å¼åè´¹ç¨ä¹å°±è¶é«ã
ä»»ä½ä¸ä¸ªç¨åºé½éè¦è¿è¡æ¹è¿å¦ä¹ æ¯ä¸ä¸ªé常漫é¿çè¿ç¨ï¼å¨å¼å§å¦ä¹ çæ¶åï¼æ¯ä¸ªäººé½ä¼ç¼åä¸äºç®åçç¨åºï¼åæç¼åçå°ç¨åºæ¯é常ç®åçï¼ä» ä» è½å¤å®ç°ä¸äºç®åçåè½ã
å¾ç®åçjavaç¨åºå¶ä½
1ãç®å½æ¹æ³1ï¼ç¼åä½ ç第ä¸ä¸ªJavaç¨åºè¦å¼å§ç¨Javaç¼åç¨åºï¼å è®¾ç½®ä½ çå·¥ä½ç¯å¢ãä»»ä½ä¸ç§ç±»ä¼¼è®°äºæ¬çç¨åºé½è½å¤ç¨äºJavaç¼ç¨ã
2ãæ¯å¦myeclipseï¼é£ä¹å°±æ¯å建ä¸ä¸ªç±»ï¼ç¶åæ²å ¥mainï¼alt+/å¯ä»¥å¯¼åºmainå½æ°ï¼Javaç¨åºçå ¥å£å°±æ¯mainï¼ãå¦æ没æç¨å·¥å ·ï¼éè¦é ç½®ç¯å¢åéçï¼é 置好ä¹åã
3ãæç®åçjava代ç è¯å®å°±æ¯è¿ä¸ªäºï¼å¦ä¸ï¼publicclassMyFirstApp{ publicstaticvoidmain(String[]args){ System.out.print(Helloworld)ï¼}}âhelloworldâå°±æ¯åºè¯¥æ¯ææå¦javaçæ°æçç第ä¸ä¸ªä»£ç äºã
4ãjavaçåä½Fontç±»ãGraphicsEnvironmentç±»ç¼ç¨é®é¢ï¼å©ç¨Fontç±»ãç»å¾ç¯å¢ç±»ï¼æç³»ç»åä½å ¨é¨æ½åºæ¥ï¼å æ¬é¢è²ãåä½ã
5ã第ä¸æ¥ï¼å¯å¨Eclipseï¼ç¬¬ä¸æ¬¡å¯å¨è½¯ä»¶æ¶ï¼ä¼æ示éæ©å·¥ä½ç©ºé´ï¼WorkSpaceï¼ï¼å¯å¨ç¡¬çä¸æ°å»ºä¸ä¸ªæ件夹ä½ä¸ºå·¥ä½ç©ºé´ï¼è¿ä¸ªæ件夹å°ä¼ä¿åä½ æç¼åçææçæºä»£ç ã第äºæ¥ï¼æ°å»ºä¸ä¸ªç®åçJavaå·¥ç¨ã
6ãå¯ä»¥åä¸ä¸ªæ¹å¤çæ件ï¼å¨éé¢è°ç¨javaèææºè¿è¡ä½ çjavaç¨åºãä¹å¯ä»¥ç¨æç§ç¼ç¨è¯è¨ï¼åvbï¼cæc++ç¼ä¸ªç¨åºï¼çæexeï¼è½è°ç¨javaèææºè¿è¡ä½ çç¨åºï¼å¾ç®åçã
æä¹ç¨è®°äºæ¬ç¼åjavaé¦å å¨çµèä¸æ°å»ºä¸ä¸ªè®°äºæ¬ï¼å°è®°äºæ¬çåç¼æ¹ä¸ºâ.javaâï¼å¦ä¸å¾æ示ãç¶å使ç¨è®°äºæ¬çæ¹å¼æå¼ï¼è¾å ¥javaç¨åºä»£ç ï¼å¦ä¸å¾æ示ãæ¥çå¨é®çä¸æâwin+Râå¿«æ·é®é®æå¼è¿è¡ï¼è¾å ¥âcmdâï¼å¦ä¸å¾æ示ã
Jconsoleï¼Javaè¿è¡ç³»ç»è°è¯åçæ§çå·¥å ·æ»ä¹ï¼jdk并ä¸æ¯ä¸ä¸ªåºè¿è½¯ä»¶ï¼å¹¶ä¸è½ä»åªéè¿è¡ã
é¦å ï¼å çççµèæ¯å¦è®¾ç½®ä¸ºæ¾ç¤ºå·²ç¥æ件æ©å±åãå¦æ没æï¼è¦å 设置ä¸ä¸ãç¹å»è®¡ç®æºï¼å·¥å ·ï¼Tï¼ï¼æ件夹é项ï¼Oï¼ï¼æ¥çï¼å¨é«çº§è®¾ç½®ä¸æ éæ¾å°éèå·²ç¥æ件æ©å±åï¼æåé¢çé©é©å»æã
å¾ç®åçåï¼å¨è®°äºæ¬éåä¸ç¸åºçjava代ç ï¼å好ä¿ååå°ç¸åºçæ件ååç¼æ¹ä¸º***.javaï¼ç¶åç¨CMDå»ç¼è¯ä¸ä¸å°±å¯ä»¥äºãå ·ä½æµç¨æ¯è¿æ ·çï¼ç¶åå°±å¯ä»¥å»CMDé£éç¼è¯åè¿è¡äºã
å ä¸è½½å®è£ javasdk6æ6以ä¸ææ°çæ¬ï¼å¹¶å®è£ ã
æ±ä¸ä¸ªç®ååæ趣çJAVAå°æ¸¸æ代ç System.out.println(çæ°å游æï¼è¯·è¾å ¥ä¸ä¸ªæ°0å°ï¼è¾å ¥-1ç»æ游æï¼)ï¼inti=sc.nextInt()ï¼if(i==-1){ breakï¼}count++ï¼if(ir){ System.out.print(ä½ çå°äºã
è¦ç¨JAVAåä¸ä¸ªå°é¡¹ç®ï¼ç±»å«ä¸éï¼é便ä»ä¹ç¨åºé½è¡ï¼ä¸ç¨å¤ªå¤æãæ好æ注éã谢谢ãè¿ä¸ªæç¹å¤ªç®åäºãæ¯ç«æ¯ä¸ä¸ªå°é¡¹ç®åã
--æ±å¤§ç¥æç¹å¦ä½ç¨javaåæ«é·å°æ¸¸æ详ç»...ææºä»£ç å--æä¹ç¨Javaåä¸ä¸ªæ«é·ç¨åºï¼è¦ååããå好äºç»å --æ±é«æåä¸ä¸ªæ«é·çJAVA代ç ï¼ææ¿åºçæ¬èµæè æ´å¤ã
第ä¸ä¸ªç±»ï¼æå¡å¨ä¸»çº¿ç¨ç±»ãpackagesrcï¼//å®ä¹ä¸ä¸ªå ï¼åæ¾JAVAæ件ã
//è¿æ¯ä¸ªè天ç¨åºï¼å¨ECLIPSEè¿è¡Client.javaå°±å¯ä»¥äºã
江西九江:优化营商环境 筑牢民生底线
natgator 源码
odel 源码
qextserialport源码
唐治平拒認屍 齒模比對結果確認是唐母
cocoapod源码