符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
我这有一个!图片你自己找!但必须改成1.jpg,2.jpg........你也可以用卡片布局!比较不错!
创新互联公司专业为企业提供丰润网站建设、丰润做网站、丰润网站设计、丰润网站制作等企业网站建设、网页设计与制作、丰润企业网站模板建站服务,10年丰润做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class bmt1 implements ActionListener
{JFrame f;
JPanel p1;
JPanel p2;
JButton b1;
JButton b2;
JButton b3;
JButton b4;
JLabel l1;
ImageIcon icon1;
ImageIcon icon2;
ImageIcon icon3;
ImageIcon icon4;
Boolean ture;
int n=0;
public bmt1()
{f=new JFrame("版面布局");
f.setSize(400,500);
f.setVisible(true);
Container con=f.getContentPane();
con.setLayout(new GridLayout(2,1));
p1=new JPanel();
p2=new JPanel();
con.add(p1);
con.add(p2);
b1=new JButton("第一张");
b2=new JButton("下一张");
b3=new JButton("前一张");
b4=new JButton("最后一张");
p2.add(b1);
p2.add(b2);
p2.add(b3);
p2.add(b4);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
p2.setLayout(new FlowLayout());
l1=new JLabel();
p1.add(l1);
icon1=new ImageIcon("1.jpg");
icon2=new ImageIcon("2.jpg");
icon3=new ImageIcon("3.jpg");
icon4=new ImageIcon("4.jpg");
f.addWindowListener(new WindowAdapter()
{public void windowClosing(WindowEvent e)
{System.exit(0);}
});
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==b1)
{ n=1;
l1.setIcon(new ImageIcon("1.jpg"));}
if(e.getSource()==b2)
{ n=n+1;
if(n4){n=1;}
String s=String.valueOf(n);
l1.setIcon(new ImageIcon(s+".jpg"));}
if(e.getSource()==b3)
{ if(n1){n=4;}
n=n-1;
String s=String.valueOf(n);
l1.setIcon(new ImageIcon(s+".jpg"));}
if(e.getSource()==b4)
{n=4;
l1.setIcon(new ImageIcon("4.jpg"));}
}
public static void main(String args[])
{new bmt1();}
}
挺容易的,如果你学awt的话可以很容易实现
主要是一个图像类和绘图类,然后画到Frame上面即可
我只实现了放大缩小功能,旋转还有点问题package com.lzw;import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/*
* @功能:实现图片的放大缩小与旋转功能
* @日期:2011.6.29
*/
public class OperationOnPic extends JFrame{
private JPanel imageJpanel;
private JPanel southJpanel;
private JButton rorateButton;
private Mycanvas canvas ;
private int imgWidth, imgHeight;
private JSlider jSlide; //滑动块组建
// private JScrollPane jScrollPane ;
Image img;
private static int num=0;
private static int newWidth=0;
private static int newHeigth=0;
public static boolean isroate=false;
public OperationOnPic(){
setTitle("图片操作");
//设置窗体大小
setSize(800, 600);
//设置窗体显示在中央位置
setLocationRelativeTo(null);
//URL imgUrl = OperationOnPic.class.getResource("2.jpg"); //获得图片路径
//img = Toolkit.getDefaultToolkit().getImage(imgUrl);// 获取图片资源
ImageIcon image=new ImageIcon(OperationOnPic.class.getResource("2.jpg"));
img=image.getImage();
canvas=new Mycanvas();
//调用布局方法
init();
//设置窗体可见
setVisible(true);
}
public void init(){
setDefaultCloseOperation(this.EXIT_ON_CLOSE); //设置窗体可关闭
imageJpanel=new JPanel();
southJpanel=new JPanel();
imageJpanel.setLayout(new BorderLayout());
imageJpanel.add(canvas,BorderLayout.CENTER);
imageJpanel.add(getJSlider(),BorderLayout.SOUTH);
rorateButton=new JButton("图片旋转");
rorateButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
num+=5;
isroate=true;
canvas.repaint();
isroate=false;
}
});
southJpanel.add(rorateButton); //将按钮添加到面板上
this.getContentPane().add(imageJpanel,BorderLayout.CENTER);
this.getContentPane().add(southJpanel,BorderLayout.SOUTH);
}
public JSlider getJSlider(){
if(jSlide==null){
jSlide=new JSlider(); //实例化一个滑动块对象
jSlide.setMaximum(500); //设置滑动块的最大取值
jSlide.setMinimum(1); //设置滑动块的最小取值
jSlide.setValue(50); //设置滑动块当前值
jSlide.addChangeListener(new ChangeListener(){ public void stateChanged(ChangeEvent e) {
// TODO Auto-generated method stub
canvas.repaint(); //重新绘制图像
}
});
}
return jSlide;
}
public static void main(String[] args) {
new OperationOnPic();
}
class Mycanvas extends Canvas{
public void paint(final Graphics g){ //重写paint
if(isroate==false){
imgWidth=img.getWidth(this);
imgHeight=img.getHeight(this);
float value=jSlide.getValue(); //取得滑动块的值
newWidth=(int)(imgWidth*value/100);
newHeigth=(int)(imgHeight*value/100);
g.drawImage(img,0,0,newWidth,newHeigth,this);
g.dispose();
}else{
num+=5;
Graphics2D g2=(Graphics2D)g;
g2.rotate(Math.toRadians(num));
g2.drawImage(img,0,0,400,400,this);
g.dispose();
}
}
}