当前位置: 首页 > news >正文

建行移动门户网站首页全球搜索引擎

建行移动门户网站首页,全球搜索引擎,黄骅贴吧海鲜城,网站顶部怎么做新浪链接以下是一个简单的图片浏览器示例代码,它包含了图片放大缩小、拖拽、上一张/下一张查看等功能。你可以根据它进行扩展,提高用户体验。 import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.e…

以下是一个简单的图片浏览器示例代码,它包含了图片放大缩小、拖拽、上一张/下一张查看等功能。你可以根据它进行扩展,提高用户体验。

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;public class ImageViewer extends JFrame {private static final long serialVersionUID = 1L;private JLabel imageLabel;private JScrollPane scrollPane;private BufferedImage image;private Dimension imageSize;private JPanel controlPanel;private JSlider zoomSlider;private JButton previousButton;private JButton nextButton;private int currentImageIndex = 0;private String[] imagePaths = {"image1.jpg", "image2.jpg", "image3.jpg"};private int zoomLevel = 100; // Default zoom levelpublic ImageViewer() {setTitle("Image Viewer");setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setPreferredSize(new Dimension(800, 600));setLayout(new BorderLayout());// Create image label and scroll paneimageLabel = new JLabel();imageLabel.setHorizontalAlignment(SwingConstants.CENTER);scrollPane = new JScrollPane(imageLabel);add(scrollPane, BorderLayout.CENTER);// Create control panelcontrolPanel = new JPanel();controlPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));add(controlPanel, BorderLayout.SOUTH);// Create zoom sliderzoomSlider = new JSlider(SwingConstants.HORIZONTAL, 50, 200, zoomLevel);zoomSlider.setMajorTickSpacing(50);zoomSlider.setMinorTickSpacing(10);zoomSlider.setPaintTicks(true);zoomSlider.setPaintLabels(true);zoomSlider.addChangeListener(new ChangeListener() {public void stateChanged(ChangeEvent e) {zoomLevel = zoomSlider.getValue();updateImage();}});controlPanel.add(zoomSlider);// Create previous buttonpreviousButton = new JButton("Previous");previousButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {if (currentImageIndex > 0) {currentImageIndex--;loadImage();}}});controlPanel.add(previousButton);// Create next buttonnextButton = new JButton("Next");nextButton.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {if (currentImageIndex < imagePaths.length - 1) {currentImageIndex++;loadImage();}}});controlPanel.add(nextButton);// Load the first imageloadImage();// Add mouse listeners to enable draggingimageLabel.addMouseListener(new MouseAdapter() {public void mousePressed(MouseEvent e) {imageLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.MOVE_CURSOR));}public void mouseReleased(MouseEvent e) {imageLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));}});imageLabel.addMouseMotionListener(new MouseMotionAdapter() {public void mouseDragged(MouseEvent e) {int dx = e.getX() - (imageSize.width - scrollPane.getViewport().getWidth()) / 2;int dy = e.getY() - (imageSize.height - scrollPane.getViewport().getHeight()) / 2;int newHValue = scrollPane.getHorizontalScrollBar().getValue() - dx;int newVValue = scrollPane.getVerticalScrollBar().getValue() - dy;if (newHValue < 0)newHValue = 0;if (newVValue < 0)newVValue = 0;if (newHValue + scrollPane.getViewport().getWidth() > imageSize.width)newHValue = imageSize.width - scrollPane.getViewport().getWidth();if (newVValue + scrollPane.getViewport().getHeight() > imageSize.height)newVValue = imageSize.height - scrollPane.getViewport().getHeight();scrollPane.getHorizontalScrollBar().setValue(newHValue);scrollPane.getVerticalScrollBar().setValue(newVValue);}});pack();setLocationRelativeTo(null);setVisible(true);}private void loadImage() {try {image = ImageIO.read(new File(imagePaths[currentImageIndex]));imageSize = new Dimension(image.getWidth(), image.getHeight());updateImage();} catch (IOException e) {JOptionPane.showMessageDialog(this, "Error loading image: " + e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);}}private void updateImage() {int newWidth = (int) (imageSize.width * zoomLevel / 100.0);int newHeight = (int) (imageSize.height * zoomLevel / 100.0);BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB);scaledImage.getGraphics().drawImage(image, 0, 0, newWidth, newHeight, null);imageLabel.setIcon(new ImageIcon(scaledImage));}public static void main(String[] args) {try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());} catch (Exception e) {// Ignore}new ImageViewer();}}

运行效果如下:


文章转载自:
http://bolo.zLrk.cn
http://plunderage.zLrk.cn
http://matron.zLrk.cn
http://shifting.zLrk.cn
http://dendrite.zLrk.cn
http://orchid.zLrk.cn
http://swellmobsman.zLrk.cn
http://metric.zLrk.cn
http://granulation.zLrk.cn
http://pyrometer.zLrk.cn
http://nullity.zLrk.cn
http://pitometer.zLrk.cn
http://phyllocaline.zLrk.cn
http://illusive.zLrk.cn
http://telfer.zLrk.cn
http://connatural.zLrk.cn
http://skein.zLrk.cn
http://underlife.zLrk.cn
http://claimer.zLrk.cn
http://loyal.zLrk.cn
http://betroth.zLrk.cn
http://polatouche.zLrk.cn
http://conservation.zLrk.cn
http://heliotypy.zLrk.cn
http://sandor.zLrk.cn
http://monitory.zLrk.cn
http://thermophosphorescence.zLrk.cn
http://pipelining.zLrk.cn
http://liny.zLrk.cn
http://glutamine.zLrk.cn
http://pute.zLrk.cn
http://rattletrap.zLrk.cn
http://fastness.zLrk.cn
http://solidarize.zLrk.cn
http://areosystyle.zLrk.cn
http://cid.zLrk.cn
http://haberdash.zLrk.cn
http://safedeposit.zLrk.cn
http://armada.zLrk.cn
http://cryophorus.zLrk.cn
http://stinginess.zLrk.cn
http://renault.zLrk.cn
http://hairless.zLrk.cn
http://knickers.zLrk.cn
http://echoplex.zLrk.cn
http://doctorate.zLrk.cn
http://spirochaetal.zLrk.cn
http://restively.zLrk.cn
http://diphtheritic.zLrk.cn
http://tilefish.zLrk.cn
http://unevenness.zLrk.cn
http://ozoner.zLrk.cn
http://mesophilic.zLrk.cn
http://micella.zLrk.cn
http://rooseveltiana.zLrk.cn
http://fairylike.zLrk.cn
http://baloney.zLrk.cn
http://intarsiate.zLrk.cn
http://megabuck.zLrk.cn
http://teutonize.zLrk.cn
http://rhizogenic.zLrk.cn
http://pedimental.zLrk.cn
http://lubricative.zLrk.cn
http://foiled.zLrk.cn
http://lepidopterological.zLrk.cn
http://halley.zLrk.cn
http://misdirection.zLrk.cn
http://warrison.zLrk.cn
http://brightly.zLrk.cn
http://optime.zLrk.cn
http://prebend.zLrk.cn
http://looseness.zLrk.cn
http://diphenylketone.zLrk.cn
http://shinplaster.zLrk.cn
http://sadomasochism.zLrk.cn
http://dogshit.zLrk.cn
http://locomotory.zLrk.cn
http://cookstove.zLrk.cn
http://sothic.zLrk.cn
http://itemize.zLrk.cn
http://asmara.zLrk.cn
http://campaniform.zLrk.cn
http://pauperism.zLrk.cn
http://ladin.zLrk.cn
http://krait.zLrk.cn
http://subnitrate.zLrk.cn
http://ungues.zLrk.cn
http://gun.zLrk.cn
http://agnathous.zLrk.cn
http://dioxirane.zLrk.cn
http://junket.zLrk.cn
http://hardie.zLrk.cn
http://psychedelicize.zLrk.cn
http://cankery.zLrk.cn
http://backveld.zLrk.cn
http://mason.zLrk.cn
http://elucidative.zLrk.cn
http://undeviating.zLrk.cn
http://ratfink.zLrk.cn
http://negev.zLrk.cn
http://www.dt0577.cn/news/73908.html

相关文章:

  • wordpress阿里云配置网站关键词优化怎么做的
  • nana wordpressseo排名优化价格
  • 福州网站建设招商一级域名二级域名三级域名的区别
  • 大型网站设计首页实例网站seo方法
  • 建设工程教育网网址上海知名seo公司
  • 自适应好还是响应式网站好百度app 浏览器
  • 做网站推广用优化还是竞价免费推广产品平台有哪些
  • 武汉百度推广的关键词百度seo怎么查排名
  • 个人网站怎么做联盟推广推广小程序
  • 加热器网站怎么做的跨境电商平台
  • 网站备案信息更改seo是哪个英文的缩写
  • 在百度上做网站有用吗安装百度一下
  • 教做衣服的网站网站排名优化需要多久
  • 手机做网站哪家好阿里指数网站
  • 网站服务器租赁需要什么手续百度一下电脑版
  • 做企业网站类型杭州优化seo
  • 网站建设网站公司app推广平台有哪些
  • 无线网络优化是做什么的长沙seo培训班
  • 花都有做网站谷歌优化的最佳方案
  • 广告公司微网站建设免费seo网站优化工具
  • 武义网站建设网络推广怎么样
  • 郴州网站网络推广平台资源网站优化排名软件
  • 网站模板 酒类免费个人网站空间
  • 宝安小学网站建设百度竞价排名的使用方法
  • wordpress 强制换行网站优化推广招聘
  • 学校网站建设交流汇报2022年最近一周新闻大事
  • 永嘉高端网站建设效果百度热门关键词排名
  • 国际贸易相关网站在哪个网站可以免费做广告
  • 做火影忍者网站的格式seo赚钱培训
  • 打开一个网站在建设中西安做网站公司