亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? imageprocessingclient.java

?? java的一些教程 大家看看,很有用的
?? JAVA
字號:
// Fig. 23.25 ImageProcessingClient.java
// The application asks for user-specified image file, image 
// filter type and image partition number, filters the image
// and displays the processed image.
package com.deitel.advjhtp1.javaspace.ImageProcessor;

// Java core packages
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;

// Java extension packages
import javax.swing.*;

// Jini core packages
import net.jini.core.lease.Lease;
import net.jini.core.entry.*;
import net.jini.core.transaction.*;
import net.jini.core.transaction.server.TransactionManager;

// Jini extension packages
import net.jini.space.JavaSpace;

// Deitel packages
import com.deitel.advjhtp1.javaspace.common.*;

public class ImageProcessingClient extends JFrame {

   private String[] operations = { "BLUR", "COLOR",
      "INVERT", "SHARP" };
   private JButton okButton;
   private JComboBox operationComboBox;
   private JTextField imageText;
   private JTextField numberText;
 
   private static String hostname = "";
   private String imageName;
   private String operation = "BLUR";
   private int partitionNumber = 0;

   public ImageProcessingClient( String host )
   {
      super ( "ImageProcessInput" );

      hostname = host;
      Container container = getContentPane();

      // define the center panel
      JPanel centerPanel = new JPanel();
      centerPanel.setLayout( new GridLayout( 3, 2, 0, 5 ) );

      // add image label
      JLabel imageLabel = new JLabel( "Image File:", 
         SwingConstants.CENTER );
      centerPanel.add( imageLabel );

      JButton openFile = new JButton( 
         "Choose file to process" );
      openFile.addActionListener( 

         new ActionListener() {

            public void actionPerformed( ActionEvent event )
            {
               JFileChooser fileChooser = new JFileChooser();
               
               fileChooser.setFileSelectionMode( 
                  JFileChooser.FILES_ONLY );
               int result = fileChooser.showOpenDialog( null );
               File file;

               // user clicked Cancel button on dialog
               if ( result == JFileChooser.CANCEL_OPTION )
                  file = null;
               else {
                  file = fileChooser.getSelectedFile();
                  imageName = file.getPath();
               }

            } // end method actionPerformed

         } // end ActionListener constructor

      ); // end addActionListener

      centerPanel.add( openFile );

      // add number label
      JLabel numberLabel = new JLabel( "Partition Number:", 
         SwingConstants.CENTER );
      centerPanel.add( numberLabel );

      // add number text field
      numberText = new JTextField( 10 );
      centerPanel.add( numberText );

      // install a listener to the number text field
      numberText.addActionListener( 

         new ActionListener() {

            // get the text when the user feeds a return 
            // character in the text field
            public void actionPerformed( ActionEvent event ) 
            {
               partitionNumber = Integer.parseInt(
                  event.getActionCommand() );
            }
         }
      );

      // add operation label
      JLabel operationLabel = new JLabel( "Operation Type:", 
         SwingConstants.CENTER );
      centerPanel.add( operationLabel );

      // add a combo box
      operationComboBox = new JComboBox( operations );
      operationComboBox.setSelectedIndex( 0 );
      centerPanel.add( operationComboBox );

      // install a listener to the combo box
      operationComboBox.addItemListener( 

         new ItemListener() {

            // an operation other than BLUR is selected
            public void itemStateChanged( ItemEvent itemEvent )
            {
               operation = 
                  ( String ) operationComboBox.getSelectedItem();
            }
         }
      );

      // define the button panel    
      JPanel buttonPanel = new JPanel();
      buttonPanel.setLayout( new GridLayout( 1, 1, 0, 5 ) );

      // add the OK button
      okButton = new JButton( "OK" );
      buttonPanel.add( okButton );

      // add a listener to the OK button
      okButton.addActionListener(

         new ActionListener() {

            // partition image file into number of pieces user 
            // specified
            public void actionPerformed( ActionEvent event ) 
            {
               // get user inputs
               partitionNumber = Integer.parseInt( 
                  numberText.getText() );

               // check whether the user 
               // fills in both text fields
               if ( ( partitionNumber == 0 ) 
                  || ( imageName == null ) ) {
                     JOptionPane.showMessageDialog( null, 
                      "Either image name or partition number " 
                      + "is not specified!", "Error", 
                      JOptionPane.ERROR_MESSAGE);
               }

               else {
                  setVisible( false );

                  // partition the image into smaller pieces 
                  // and store the sub images into a JavaSpace
                  ImageSeparator imageSeparator = 
                     new ImageSeparator( 
                        imageName, operation, partitionNumber );
                  imageSeparator.partitionImage();
                  imageSeparator.storeImage( hostname );
                  imageSeparator.displayImage();
                  collect();
               }

            } // end method actionPerformed

         } // end ActionListener constructor

      ); // end addActionListener

      // put everything together
      container.add( centerPanel, BorderLayout.CENTER );
      container.add( buttonPanel, BorderLayout.SOUTH );

   } // end ImageProcessingClient constructor

   // collect processed images
   public void collect()
   {
      // get the JavaSpace
      String jiniURL = "jini://" +  hostname;
      JavaSpaceFinder findtool = 
         new JavaSpaceFinder( jiniURL );
      JavaSpace space = findtool.getJavaSpace();

      Vector unOrderedImages = new Vector();
      Vector orderedImages = null;

      // removes all images in the JavaSpace 
      // that have the specified name
      try {
         double squareRoot = Math.sqrt( partitionNumber );

         if ( Math.floor( squareRoot ) != ( squareRoot ) ) 
            partitionNumber = 4; 

         // specify the matching template
         ImageEntry template = new ImageEntry( imageName, true );

         // snapshot the template
         Entry snapshotEntry = space.snapshot( template );
 
         // collect images
         for ( int i = 0; i < partitionNumber ; i++ ) {
            ImageEntry remove = ( ImageEntry ) space.take(
               snapshotEntry, null, Lease.FOREVER );
            unOrderedImages.add( remove );
         }

         int imageCount = unOrderedImages.size();
         orderedImages = 
            new Vector( imageCount );

         // initialize the Vector
         for ( int i = 0; i < imageCount; i++ )
            orderedImages.add( null );
    
         // order the sub images
         for ( int i = 0; i < imageCount; i++ ) {
            ImageEntry image = 
               ( ImageEntry ) unOrderedImages.elementAt( i );
            orderedImages.setElementAt( 
               image.imageIcon, image.number.intValue() );
         }

      } // end try

      // handle exception collecting images 
      catch ( Exception exception ) {
         exception.printStackTrace();
      }   

      // put images together and display the result image
      if ( orderedImages.size() > 0) {
         ImageParser imageParser = new ImageParser();

         ImageIcon icon = imageParser.putTogether( 
            orderedImages );

         ImageDisplayer imageDisplayer = 
            new ImageDisplayer( icon );

         imageDisplayer.setSize( icon.getIconWidth() + 50, 
            icon.getIconHeight() + 50 );
         imageDisplayer.setVisible( true );
         imageDisplayer.setDefaultCloseOperation( 
            JFrame.EXIT_ON_CLOSE );
      }

      else {
         JOptionPane.showMessageDialog( null, 
            "Invalid image name", "Error", 
            JOptionPane.ERROR_MESSAGE);

         // terminate program
         System.exit( 0 );
      }
      
   } // end method collect

   public static void main( String[] args )
   {
      // get the hostname
      if ( args.length != 1 ) {
         System.out.println( 
            "Usage: ImageProcessingClient hostname" );
         System.exit( 1 );
      }
      
      ImageProcessingClient processor = 
         new ImageProcessingClient( args[ 0 ] );

      // set the window size and display it
      processor.setSize( 350, 150 );
      processor.setVisible( true );
     
   } // end method main
}

/***************************************************************
 * (C) Copyright 2002 by Deitel & Associates, Inc. and         *
 * Prentice Hall. All Rights Reserved.                         *
 *                                                             *
 * DISCLAIMER: The authors and publisher of this book have     *
 * used their best efforts in preparing the book. These        *
 * efforts include the development, research, and testing of   *
 * the theories and programs to determine their effectiveness. *
 * The authors and publisher make no warranty of any kind,     *
 * expressed or implied, with regard to these programs or to   *
 * the documentation contained in these books. The authors     *
 * and publisher shall not be liable in any event for          *
 * incidental or consequential damages in connection with, or  *
 * arising out of, the furnishing, performance, or use of      *
 * these programs.                                             *
 ***************************************************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久另类综合| 亚洲国产aⅴ成人精品无吗| 亚洲欧美影音先锋| 日一区二区三区| 一本色道久久综合亚洲aⅴ蜜桃| 欧美大胆一级视频| 一区二区三区欧美久久| 国产成人啪午夜精品网站男同| 欧美主播一区二区三区| 国产精品拍天天在线| 美腿丝袜亚洲三区| 欧美日韩视频不卡| 亚洲乱码日产精品bd| 91精品国模一区二区三区| 国产精品免费久久| 国产一区二区三区在线观看免费 | 精品国产三级a在线观看| 亚洲欧美激情小说另类| 成人午夜在线视频| 久久久久久9999| 精品一区二区三区不卡| 在线成人小视频| 亚洲高清不卡在线| 欧美在线制服丝袜| 亚洲一区二区三区视频在线播放| 99久久精品国产一区二区三区 | 中文字幕在线不卡视频| 国产高清不卡二三区| 精品国内二区三区| 国内精品视频一区二区三区八戒| 日韩一级大片在线观看| 日韩av电影一区| 欧美一区二区三区四区视频| 日韩国产欧美三级| 日韩午夜在线影院| 久久99精品久久只有精品| 56国语精品自产拍在线观看| 日韩av中文字幕一区二区三区| 91.麻豆视频| 久久精品国产99| 久久久国产综合精品女国产盗摄| 国产精品一品视频| 欧美国产精品专区| 99精品视频免费在线观看| 亚洲美女视频一区| 欧美日韩午夜在线视频| 日本不卡一区二区三区| 欧美成va人片在线观看| 国产91露脸合集magnet| 中文字幕一区二区日韩精品绯色| 97久久精品人人爽人人爽蜜臀| 亚洲精品久久久久久国产精华液| 欧美最新大片在线看 | 日韩欧美第一区| 国产一区高清在线| 国产精品家庭影院| 欧美三级日本三级少妇99| 久久精品99国产精品日本| 久久久久国产精品免费免费搜索| 成人综合婷婷国产精品久久| 尤物av一区二区| 日韩免费一区二区| 欧美午夜电影在线播放| 国内成人精品2018免费看| 中文字幕在线免费不卡| 7777女厕盗摄久久久| 国产激情视频一区二区三区欧美 | 国产精品乱人伦中文| 在线观看日韩一区| 精品一区二区免费| 亚洲精品免费在线播放| 日韩欧美国产麻豆| 色偷偷久久一区二区三区| 美国精品在线观看| 亚洲色图第一区| 久久亚洲精精品中文字幕早川悠里 | 色婷婷综合在线| 麻豆精品一区二区三区| 伊人开心综合网| 久久青草欧美一区二区三区| 日本精品一级二级| 国产在线视频一区二区三区| 亚洲一区二区3| 国产精品五月天| 精品毛片乱码1区2区3区| 在线看日韩精品电影| 国产成人精品免费看| 日韩和欧美一区二区| 自拍偷拍国产精品| www国产成人| 欧美一级在线视频| 欧美日韩中字一区| 色综合久久综合中文综合网| 国产又黄又大久久| 麻豆国产91在线播放| 午夜一区二区三区视频| 伊人色综合久久天天| 亚洲欧美色综合| 国产日韩欧美高清| 精品国产免费人成电影在线观看四季| 欧美日韩在线免费视频| 91在线一区二区三区| 成人免费视频视频在线观看免费| 久久99久久99精品免视看婷婷| 午夜精品一区二区三区三上悠亚| 亚洲精品国产精华液| 亚洲日本青草视频在线怡红院| 中文一区一区三区高中清不卡| 久久理论电影网| 精品国产乱码久久久久久闺蜜 | 麻豆视频一区二区| 日韩精品一区第一页| 午夜精彩视频在线观看不卡| 亚洲一区二区欧美日韩| 亚洲国产精品麻豆| av影院午夜一区| 国产成人av自拍| 成人一级片网址| 99久久免费视频.com| av亚洲精华国产精华精| 色综合色综合色综合 | eeuss鲁片一区二区三区| a在线欧美一区| 在线观看免费成人| 欧美日韩一区在线观看| 欧美乱妇23p| 日韩欧美在线123| 久久久午夜电影| 日韩码欧中文字| 亚洲小少妇裸体bbw| 婷婷中文字幕一区三区| 久久av资源网| 春色校园综合激情亚洲| 91福利精品视频| 69精品人人人人| 久久久久国产精品免费免费搜索 | 久久久久久久免费视频了| 欧美激情在线一区二区| 亚洲视频免费在线观看| 亚洲成a人v欧美综合天堂下载| 免费一级欧美片在线观看| 国产成人在线影院| 在线精品视频一区二区| 欧美成人免费网站| 中文字幕一区二区三区精华液 | 成人精品免费看| 在线免费观看视频一区| 精品国产露脸精彩对白| 综合自拍亚洲综合图不卡区| 亚洲午夜一区二区| 激情五月婷婷综合| 色先锋aa成人| 国产精品免费视频观看| 日韩制服丝袜av| av福利精品导航| 欧美成人精品1314www| 亚洲少妇30p| 国产一区91精品张津瑜| 欧美日韩国产欧美日美国产精品| 精品国产一区二区精华| 亚洲免费伊人电影| 国产麻豆视频一区二区| 欧美视频完全免费看| 国产精品成人网| 久久精品国产精品亚洲精品| 欧美在线观看一区| 国产精品另类一区| 久久超碰97人人做人人爱| 欧美在线你懂的| 中文字幕在线不卡| 国产成人精品一区二| 欧美本精品男人aⅴ天堂| 亚洲国产综合在线| 91亚洲精品久久久蜜桃| 久久久久久久电影| 日本中文一区二区三区| 欧美性猛交xxxxxxxx| 国产精品久久久久精k8| 国产成人免费在线| 精品福利一二区| 美女www一区二区| 欧美精选午夜久久久乱码6080| 国产一区在线不卡| 欧美一区二区三区播放老司机| 亚洲欧美日本韩国| 成人高清视频在线| 欧美激情一区二区三区在线| 久草中文综合在线| 日韩精品一区二区三区老鸭窝| 五月天丁香久久| 欧美亚洲动漫制服丝袜| 亚洲一区二区三区自拍| 日本韩国精品一区二区在线观看| 中文字幕av一区二区三区高| 国产一区二区在线视频| 国产色一区二区| 成人理论电影网| 国产精品国产a级| 99久精品国产| 亚洲精品国产第一综合99久久|