资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java代码在哪里修改 java代码在哪里修改的

java代码修改

改好了,你把图片的地址改一下,注意路径

创新互联专注为客户提供全方位的互联网综合服务,包含不限于成都做网站、网站设计、鹤山网络推广、成都小程序开发、鹤山网络营销、鹤山企业策划、鹤山品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供鹤山建站搭建服务,24小时服务热线:028-86922220,官方网址:www.cdcxhl.com

import java.awt.FlowLayout;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import javax.swing.Icon;

import javax.swing.ImageIcon;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JList;

import javax.swing.JScrollPane;

import javax.swing.event.ListSelectionEvent;

import javax.swing.event.ListSelectionListener;

public class e extends JFrame implements ListSelectionListener{

private JList jl;

private JLabel b1;

private String name[]={"picture 1","picture 2","picture 3"};

private Icon icon[]={new ImageIcon("picture 1.jpg"),new ImageIcon("picture 2.jpg"),new ImageIcon("picture 3.jpg")};

public e(){

super("列表框中显示图形文件");

this.getContentPane().setLayout(new FlowLayout());

jl=new JList(name);

jl.setVisibleRowCount(3);

jl.addListSelectionListener(this);

this.getContentPane().add(new JScrollPane(jl));

b1=new JLabel("picture 1");

this.getContentPane().add(b1);

this.setSize(400,400);

this.setVisible(true);

}

public static void main(String args[]){

e ex=new e();

ex.addWindowListener(new WindowAdapter(){

public void WindowClosing(WindowEvent k){

System.exit(0);

}

});

}

public void valueChanged(ListSelectionEvent k){

b1.setIcon(icon[jl.getSelectedIndex()]);

}

}

Java 要实现此功能 代码应该如何修改?

Connection conn;

try {

Class.forName("oracle.jdbc.driver.OracleDriver");

conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:taian", "hr", "hr"); //连接Oracle

conn.setAutoCommit(false);

Statement myStat = conn.createStatement();

String sqlTxt = "update BankAccount set account=account-" + this.amount.getText() + " where accId=" + this.payOut.getText();

System.out.println("第一步 执行:" + sqlTxt);

//

try {

int affectedRow = myStat.executeUpdate(sqlTxt);

System.out.println("从汇出方扣减" + this.amount.getText() + "元,修改了" + affectedRow + "行数据.");

sqlTxt = "update BankAccount set account=account+" + this.amount.getText() + " where accId=" + this.saveIn.getText();

System.out.println("第二步 执行:" + sqlTxt);

affectedRow = myStat.executeUpdate(sqlTxt);

System.out.println("从汇入方增加" + this.amount.getText() + "元,修改了" + affectedRow + "行数据.");

// 事务成功结束, 提交

conn.commit();

} catch (SQLException sqlEx) {

System.out.println

sqlEx.printStackTrace();

// 事务中断,整体回滚到事务开始前状态

conn.rollback();

}

myStat.close();

conn.close();

} catch (Exception ex) {

System.out.println("反正是出错了.");

}

}//

编译源码 后,怎么改 java源码重新编译

Java程序的运行需要经历三个步骤:

编辑

编译

运行

其中,编辑是编写源码的过程,编译是将源码编译成.class文件。运行时,找的就是.class文件,运行程序时,以main函数为入口,开始执行程序,重点是,下次程序运行时,JVM虚拟机不会再次编译源码,而是直接寻找对应的.class文件,从而运行程序。

所以,编译源码后,如果有新的修改,需要重新编译,生成.class文件,然后,才会执行。

修改源码后若不编译便直接运行,JVM使用的仍然是上一次运行的.class文件。

你好请问这个java代码怎么修改?

你的主函数没有错误,你应该恢复主函数原来的样子public static void main(String[] args){

User user=new User();

user.setId(1001);

user.setName("user");

user.setStuNum("1001");

new TicketBooker(user);

}你的Java程序是在109行JCB_Year.setSelectedIndex(date.getYear()+1900-Integer.parseInt(arrayYear[0]));这句出问题了,因为今年是2018年,date.getYear()+1900=2018,2018-2014=4,JCB_Year.setSelectedIndex(4);而你的private JComboBox JCB_Year=new JComboBox(arrayYear);arrayYear是只定义了三个字符串的数组

private static final String arrayYear[]={"2014","2015","2016"};所以造成JComboBox下标Index越界,本来下标只有0到2你访问到了4.改正办法把arrayYear数组加两个元素,把private static final String arrayYear[]={"2014","2015","2016"};改成private static final String arrayYear[]={"2014","2015","2016","2017","2018"};就没问题了.注意,arrayYear数组 2019年还需要加"2019",2020年还需要加"2020"

修改JAVA代码

首先我先说下jdk是不支持泛型的,但是可以用强制转型的方式

1.去掉每个类的的东西,如改写成List sockets=new ArrayList();报错的地方用强制转型的方式改写,如(Socket) socket

2.ChatToMul这个类中for循环改写为Iterator

for(Iterator it = sockets.iterator();it.hasNext();){

Socket socketto = (Socket) it.next();

PrintWriter pw=MyUtil.getPrintWriter(socket);

PrintWriter pwto=MyUtil.getPrintWriter(socketto);

pw.println(socket.getRemoteSocketAddress().toString()+"对"+

socketto.getRemoteSocketAddress().toString()+"说:"+message);

pw.flush();

pwto.println(socket.getRemoteSocketAddress().toString()+"对"+

socketto.getRemoteSocketAddress().toString()+"说:"+message);

pwto.flush();

}

这样基本改写成功。

如果需要源代码话,就联系我,我传给你,

代码改写不易,望采纳


当前文章:java代码在哪里修改 java代码在哪里修改的
标题网址:http://cdkjz.cn/article/hgjhsp.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220