Java程序设计

Python08

Java程序设计,第1张

public class Test extends JFrame implements ActionListener,ListSelectionListener{

String[] color={"红色","蓝色","绿色"}

String[] shape={"圆形","矩形","扇形"}

JButton big=new JButton("大")

JButton small=new JButton("小")

JList jlShape=new JList(shape)

JList jlColor=new JList(color)

JPanel jpButton=new JPanel()

JPanel jp=new JPanel()

PanelPaint jpPaint=new PanelPaint()

int flagShape=1

int flagColor=1

int flagChange=0

Test(){

jlShape.setSelectedIndex(0)

jlColor.setSelectedIndex(0)

jlShape.addListSelectionListener(this)

jlColor.addListSelectionListener(this)

big.addActionListener(this)

small.addActionListener(this)

jp.add(jlShape)jp.add(jlColor)

jpButton.add(big)jpButton.add(small)

add(jp,BorderLayout.NORTH)

add(jpPaint,BorderLayout.CENTER)

add(jpButton,BorderLayout.SOUTH)

setSize(500, 500)

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

setLocationRelativeTo(null)

setVisible(true)

}

public static void main(String[] args) {

new Test()

}

@Override

public void actionPerformed(ActionEvent ae) {

if(ae.getSource()==big){

flagChange=1

}

if(ae.getSource()==small){

flagChange=0

}

jpPaint.repaint()

}

@Override

public void valueChanged(ListSelectionEvent lse) {

if(lse.getSource()==jlShape){

if(lse.getValueIsAdjusting()==true){

if(jlShape.getSelectedIndex()==0){

flagShape=1

}else if(jlShape.getSelectedIndex()==1){

flagShape=2

}else if(jlShape.getSelectedIndex()==2){

flagShape=3

}

jpPaint.repaint()

}

}

if(lse.getSource()==jlColor){

if(lse.getValueIsAdjusting()==true){

if(jlColor.getSelectedIndex()==0){

flagColor=1

}else if(jlColor.getSelectedIndex()==1){

flagColor=2

}else if(jlColor.getSelectedIndex()==2){

flagColor=3

}

jpPaint.repaint()

}

}

}

class PanelPaint extends JPanel{

public void paint(Graphics g){

super.paint(g)

if(flagColor==1){

g.setColor(Color.RED)

}

if(flagColor==2){

g.setColor(Color.GREEN)

}

if(flagColor==3){

g.setColor(Color.BLUE)

}

if(flagChange==0){

if(flagShape==1){

g.fillOval(150,150,50,50)

}

if(flagShape==2){

g.fillArc(150,150,50,50,0,75)

}

if(flagShape==3){

g.fillRect(150,150,150,50)

}

}

if(flagChange==1){

if(flagShape==1){

g.fillOval(150,150,150,150)

}

if(flagShape==2){

g.fillArc(150,150,150,150,0,75)

}

if(flagShape==3){

g.fillRect(150,150,200,150)

}

}

}

}

}

这问题昨天已经有人回答了!我只是再拷贝一次

是打印机的压缩格式

JBIG (Joint Bi-level Image Experts Group),是由lossless image compession,的基础上特用于传真机的一种压缩技术。数据压缩的演绎法众多,其中使用于图像压缩的演绎法可粗分为两类,第一类就是lossless image compession,是一种压缩再解压缩后不会产生任何误差的演绎法。第二类则为lossy compression是一种压缩再解压缩后产生误差的演绎法。其中JBIG脱身于第一类lossless image compession,而JPEG(Joint Picture Expert Group)则是由第二类lossy compression发展而来的。这里需要说明的是,MH、MR、MMR、JBIG这几种压缩系统都是针对黑白文稿的压缩系统,而JPEG则是为了适应传真彩色文稿的需求而产生的。运用lossy compression来做图像压缩不但可以获得不错的压缩比,也可以兼顾不错的品质。

BigInteger

是java.math包里的

楼主可以具体查看一下API

不可变的任意精度的整数。所有操作中,都以二进制补码形式表示 BigInteger(如 Java 的基本整数类型)。BigInteger 提供所有 Java 的基本整数操作符的对应物,并提供 java.lang.Math 的所有相关方法。另外,BigInteger 还提供以下运算:模算术、GCD 计算、质数测试、素数生成、位操作以及一些其他操作。

java中没有BigInt

Sql中有BIGINT

SQL中的BIGINT使用带符号的BIGINT进行所有算法,因此除了位函数,不应使用大于9223372036854775807(63位)的无符号的大整数

所以java中biginteger和sql中bigint最大的区别就是,前者可以无限大,后者也是有限的