关于图形显示问题,图像太大,想显示一半,然后有一个滚动条,可以调节位置。 我要在GUI上面显示图片,由于图片太大了,我只能显示一部分,希望在上下架滚动条,可以上下滚动察看全部图片,那位高手能告诉我怎么做吗。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把图片放到JPanel中,把JPanel放到JScrollPane中。 你好,我直接把图片加载到JPanel里,图像好像会按大小自动缩放扑满JPanel;你是怎么实现图片原样大小加载到JPanel里。。JScrollPane PicScrollPane=new JScrollPane(PicturePanel);container.add(PicPanel, borderLayout.CENTER); container.add(PicScrollPane, null);应该是这样吧 import javax.swing.*;public class Test extends JFrame { private JPanel pane = null; private JScrollPane span = null; public Test() { super("Test"); pane = new JPanel(); span = new JScrollPane(pane); pane.add(new JLabel(new ImageIcon("d:/xxx.jpg"))); //span = new JScrollPane(new JLabel(new ImageIcon("d:/xxx.jpg"))); //或者直接把JLabel加到JScrollPane中也成 this.getContentPane().add(span); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(300, 200); this.setLocationRelativeTo(null); this.setVisible(true); } public static void main(String args[]) { Test t = new Test(); }} 谁能帮我看下怎样为菜单项保存添加保存图片的功能? md5 如何比较两个war包是否相等?急!在线等 试题求教! QQ主页有下载thinking in java! 我怎么觉得抽象类和接口是一回事,是吗? 怎么将网上抓回的网页保存在本地 一个关于swing的问题 关于jsp 我在网页中加入applet,为什么出错?谁能告诉我?急!!! 急!!java调用c++corba开发中遇到的汉字问题 指定日期,获取该日期所在周的周二,以及判断该天是周几的用法 有谁知道这个正则表达式这个特殊替换的??
JScrollPane PicScrollPane=new JScrollPane(PicturePanel);
container.add(PicPanel, borderLayout.CENTER);
private JPanel pane = null;
private JScrollPane span = null; public Test() {
super("Test"); pane = new JPanel();
span = new JScrollPane(pane); pane.add(new JLabel(new ImageIcon("d:/xxx.jpg")));
//span = new JScrollPane(new JLabel(new ImageIcon("d:/xxx.jpg"))); //或者直接把JLabel加到JScrollPane中也成
this.getContentPane().add(span);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(300, 200);
this.setLocationRelativeTo(null);
this.setVisible(true);
} public static void main(String args[]) {
Test t = new Test();
}}