FCXIsPig FCX=new FCXIsPig(250);
FCX.pig(FCX);
then
System.out.println("FCX is real 250,is 24k pig");
FCX.pig(FCX);
then
System.out.println("FCX is real 250,is 24k pig");
解决方案 »
- 急!!!访问数据库时比较慢?
- Hibernate更新数据,报错,求教大侠指点,万分感谢
- 字符串如何去掉空格
- 自制记事本中PopupMenu为什么不能用?
- java mail 问题
- com.enterprisedt.net.ftp.FTPClient中restart
- 如何把.java程序变成.exe可执行文件?
- 怎样判断子符串中只有固定的一些字符?(高分)
- 在Applet中如何读取服务器上的文件???
- java编程问题
- 关于线程的一点思考:为什么java.sql.Statement.executeUpdate()不声明为同步的呢?那样怎么能保证多个线程同时修改表的记录呢?
- 高分求救,懂的进来看看???
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;public class Converting extends JFrame { JLabel promptLabel; JTextField prompt; JButton promptButton; JFileChooser fileChooser; JComboBox comboBox;? JButton saveButton;? public Converting() { super("Image Conversion"); setDefaultCloseOperation(EXIT_ON_CLOSE); Container contentPane = getContentPane(); JPanel inputPanel = new JPanel(); promptLabel = new JLabel("Filename:"); inputPanel.add(promptLabel); prompt = new JTextField(20); inputPanel.add(prompt); promptButton = new JButton("Browse"); inputPanel.add(promptButton); contentPane.add(inputPanel, BorderLayout.NORTH);
fileChooser = new JFileChooser(); promptButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { int returnValue = fileChooser.showOpenDialog(null); if (returnValue == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); if (selectedFile != null) { prompt.setText(selectedFile.getAbsolutePath()); } } } } );
JPanel outputPanel = new JPanel(); String writerFormats[] = ImageIO.getWriterFormatNames(); ComboBoxModel comboBoxModel = new DefaultComboBoxModel(writerFormats); comboBox = new JComboBox(comboBoxModel); outputPanel.add(comboBox); saveButton = new JButton("Save"); outputPanel.add(saveButton); saveButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { String name = prompt.getText(); File file = new File(name); if (file.exists()) { BufferedImage image = ImageIO.read(file.toURL()); if (image == null) { System.err.println("Invalid input file format"); } else { String selection = (String)comboBox.getSelectedItem(); String outputFilename = name + "." + selection; File outputFile = new File(outputFilename); boolean found = ImageIO.write(image, selection, outputFile); if (found) { JDialog window = new JDialog(); Container windowContent = window.getContentPane(); BufferedImage newImage = ImageIO.read(outputFile); JLabel label = new JLabel(new ImageIcon(newImage)); JScrollPane pane = new JScrollPane(label); windowContent.add(pane, BorderLayout.CENTER); window.setSize(300, 300); window.show(); } else { System.err.println("Error saving"); } } } else { System.err.println("Bad filename"); } } catch (MalformedURLException mur) { System.err.println("Bad filename"); } catch (IOException ioe) { System.err.println("Error reading file"); } } } );
contentPane.add(outputPanel, BorderLayout.SOUTH);
} public static void main(String args[]) { JFrame frame = new Converting(); frame.pack(); frame.show(); }}