⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optiondialog.java

📁 一个用java编写的msn程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
			check.setFont( FONT );			check.setSelected( value!=-1 ? true : false );			check.addActionListener( new ActionListener() {				public void actionPerformed( ActionEvent e )				{					boolean sel = check.isSelected();					if( sel )						slider.setValue( slider.getValue() );					else					{						tk.makeTransparency( MainFrame.INSTANCE, -1 );						tk.makeTransparency( OptionDialog.this, -1 );						System.setProperty( "jmsn.transparency", "-1" );					}					slider.setEnabled( sel );				}			});			sliderPanel.add( slider, "Center" );			sliderPanel.add( check, "East" );			panel.add( sliderPanel );	    }        panel.add( createDummyPanel(5) );        // Timestamp property components creation.        tstampCheck = new JCheckBox( Msg.get("label.timestamp") );        tstampCheck.setFont( FONT );        tstampCheck.setAlignmentX( 0.0f );        tstampCheck.setMaximumSize( new Dimension(Short.MAX_VALUE,24) );        panel.add( tstampCheck );		// Toggle Emoticon display.		emoticonCheck = new JCheckBox( Msg.get("label.emoticon.view") );		emoticonCheck.setFont( FONT );		emoticonCheck.setAlignmentX( 0.0f );		emoticonCheck.setMaximumSize( new Dimension(Short.MAX_VALUE,24) );		panel.add( emoticonCheck );		fixedFontFaceCheck = new JCheckBox( Msg.get("label.use.fixed.font") );		fixedFontFaceCheck.setFont( FONT );		fixedFontFaceCheck.setAlignmentX( 0.0f );		fixedFontFaceCheck.setMaximumSize( new Dimension(Short.MAX_VALUE, 24) );		panel.add( fixedFontFaceCheck );		return panel;	}	private JPanel createAutoNickTab()	{		JPanel panel = new JPanel();		BoxLayout layout = new BoxLayout(panel, BoxLayout.Y_AXIS);		panel.setBorder( BorderFactory.createEmptyBorder(10,10,10,10) );		panel.setLayout( layout );				JLabel l0 = new JLabel( "Enter your friendly name as a prefix and postfix" );		l0.setFont( FONT );		panel.add( l0 );		JPanel p0 = new JPanel(new BorderLayout(5,5));		p0.setAlignmentX( 0.0f );		p0.setMaximumSize( new Dimension(Short.MAX_VALUE,24) );		JLabel l1 = new JLabel( "Prefix" );		l1.setFont( FONT );		p0.add( l1, "West" );		autoPrefixNickField = new JTextField();		autoPrefixNickField.setFont( FONT );		p0.add( autoPrefixNickField, "Center");				panel.add( p0 );		panel.add( createDummyPanel(5) );		JPanel p3 = new JPanel(new BorderLayout(5,5));		p3.setAlignmentX( 0.0f );		p3.setMaximumSize( new Dimension(Short.MAX_VALUE,24) );		JLabel l3 = new JLabel( "Postfix" );		l3.setFont( FONT );		p3.add( l3, "West" );		autoPostfixNickField = new JTextField();		autoPostfixNickField.setFont( FONT );		p3.add( autoPostfixNickField, "Center");				panel.add( p3 );		panel.add( createDummyPanel(10) );		JPanel p1 = new JPanel(new BorderLayout(5,5));		p1.setAlignmentX( 0.0f );		p1.setMaximumSize( new Dimension(Short.MAX_VALUE,24) );		JLabel l2 = new JLabel( "Access Password" );		l2.setFont( FONT );		autoNickPassField = new JTextField("jmsn");		autoNickPassField.setFont( FONT );		p1.add( l2, "West" );		p1.add( autoNickPassField, "Center" );		panel.add( p1 );		panel.add( createDummyPanel(12) );		JPanel p2 = new JPanel(new FlowLayout(FlowLayout.RIGHT, 4, 4));		p2.setAlignmentX( 0.0f );		p2.setMaximumSize( new Dimension(Short.MAX_VALUE,32) );		anStartButton = new JButton("Start");		anStartButton.setFont( FONT );		anStartButton.addActionListener( new ActionListener() {			public void actionPerformed( ActionEvent e )			{								try				{					AutoNickChangeServer.getInstance().start();					anStopButton.setEnabled( true );					anStartButton.setEnabled( false );				}				catch( Exception ex ) 				{					ex.printStackTrace();				}			}		});		anStopButton = new JButton("Stop");		anStopButton.setFont( FONT );		anStopButton.addActionListener( new ActionListener() {			public void actionPerformed( ActionEvent e )			{				anStopButton.setEnabled( false );				anStartButton.setEnabled( true );								try				{					AutoNickChangeServer.getInstance().stop();				}				catch( Exception ex ) {}			}		});		p2.add( anStartButton );		p2.add( anStopButton );		panel.add( p2 );		return panel;	}	private JPanel createDummyPanel( int height )	{		JPanel d0 = new JPanel();		d0.setAlignmentX( 0.0f );		d0.setMaximumSize( new Dimension(Short.MAX_VALUE, height) );		return d0;	}	private JPanel createBottomPanel()	{		JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10,4));		JButton confirmButton = new JButton(Msg.get("button.ok"));		confirmButton.addActionListener( new ActionListener() {			public void actionPerformed( ActionEvent e )			{				processConfirm();			}		});		confirmButton.setFont( FONT );		JButton cancelButton = new JButton(Msg.get("button.cancel"));		cancelButton.addActionListener( new ActionListener() {			public void actionPerformed( ActionEvent e )			{				dispose();			}		});		cancelButton.setFont( FONT );		bottomPanel.add( confirmButton );		bottomPanel.add( cancelButton );		return bottomPanel;	}    /**     * 荤侩磊啊 犬牢 滚瓢阑 喘范阑锭, 泅犁 汲沥茄 沥焊甸 吝 康备焊粮秦具 且 蔼甸捞 乐促搁     * 捞 皋家靛俊辑 葛滴 历厘窍霸 等促.     * 拱沸 肺弊牢 登绢乐瘤 臼促搁 公矫窍绊 弊成 dispose 瞪 巴捞促.     */	private void processConfirm()	{		if( !msnm.isLoggedIn() )		{			dispose();			return;		}		File downDir = new File( downField.getText() );		downDir.mkdirs();		File logDir = new File( chatlogField.getText() );		logDir.mkdirs();		boolean sndLogin = loginCheck.isSelected();		boolean sndMessage = messageCheck.isSelected();		boolean autoAccept = fileAutoAcceptCheck.isSelected();        boolean tstampView = tstampCheck.isSelected();		boolean emoticonView = emoticonCheck.isSelected();		boolean useFixedFont = fixedFontFaceCheck.isSelected();		LocalCopy local = msnm.getLocalCopy();		local.setProperty( MainFrame.DOWNLOAD_PROP, downDir.getAbsolutePath() );		local.setProperty( MainFrame.CHATLOG_PROP, logDir.getAbsolutePath() );		local.setProperty( MainFrame.BACKIMAGE_PROP, bgImageField.getText() );		local.setProperty( MainFrame.SOUND_LOGIN_PROP+".enable", sndLogin );		local.setProperty( MainFrame.SOUND_MESSAGE_PROP+".enable", sndMessage );		local.setProperty( MainFrame.AUTO_ACCEPT_FILE_PROP, autoAccept );        local.setProperty( MainFrame.TIMESTAMP_DISPLAY, tstampView );		local.setProperty( MainFrame.EMOTICON_DISPLAY, emoticonView );		local.setProperty( MainFrame.BUDDYLIST_FONT_COLOR,			 String.valueOf(colorButton.getBackground().getRGB()) );		local.setProperty( MainFrame.USE_FIXED_CHAT_FONT, useFixedFont );		local.setProperty( MainFrame.AUTONICK + ".enable", !anStartButton.isEnabled() );		local.setProperty( MainFrame.AUTONICK + ".prefix", autoPrefixNickField.getText() );		local.setProperty( MainFrame.AUTONICK + ".postfix", autoPostfixNickField.getText() );		local.setProperty( MainFrame.AUTONICK + ".password", autoNickPassField.getText() );				local.setProperty( MainFrame.PHOTO_PROP_USE, photoShowMe.isSelected() );		local.setProperty( MainFrame.PHOTO_PROP_LOCATION, photoPath.getText() );		local.setProperty( MainFrame.PHOTO_PROP_SHOW, photoShowOther.isSelected() );		local.storeInformation();		MusicBox.setEnabled( MusicBox.SOUND_LOGIN, sndLogin );		MusicBox.setEnabled( MusicBox.SOUND_MESSAGE_1, sndMessage );		MusicBox.setEnabled( MusicBox.SOUND_MESSAGE_2, sndMessage );		System.setProperty( "jmsn.file.auto.accept", String.valueOf(autoAccept) );		try		{			if( photoShowMe.isSelected() )			{				msnm.setMyPhoto( new File(photoPath.getText()) );				MainFrame.INSTANCE.buddies.setMyPhoto( msnm.getMyPhoto() );			}			else			{				msnm.setMyPhoto( null );				MainFrame.INSTANCE.buddies.setMyPhoto( null );			}		}		catch( Exception e )		{			e.printStackTrace();		}		try		{			if( msnm!=null && msnm.isLoggedIn() &&				!initFriendlyName.equals(nickField.getText()) )				msnm.setMyFriendlyName( nickField.getText() );			File file = new File(bgImageField.getText());			if( file.exists() )			{				ImageIcon icon = new ImageIcon( file.getAbsolutePath() );				MainFrame.INSTANCE.buddies.setBackgroundImage( icon.getImage() );			}			else				MainFrame.INSTANCE.buddies.setBackgroundImage( null );		}		catch( IOException e ) {}		MainFrame.INSTANCE.buddies.renderer.setForeColor( colorButton.getBackground() );		MainFrame.INSTANCE.buddies.repaint();			dispose();	}	private File selectDirectory( String current )	{		JFileChooser file = new JFileChooser(current);		file.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY );		if( file.showOpenDialog(this)==JFileChooser.APPROVE_OPTION )		{			return file.getSelectedFile();		}		return null;	}	private File selectFile( String current, FileFilter filter )	{		JFileChooser file = new JFileChooser(current);		file.addChoosableFileFilter( filter );		file.setFileSelectionMode( JFileChooser.FILES_ONLY );		if( file.showOpenDialog(this)==JFileChooser.APPROVE_OPTION )		{			return file.getSelectedFile();		}		return null;	}	/**	 * Option Dialog啊 积己瞪锭 捞傈 汲沥蔼阑 阂矾坷绰 殿狼 霖厚累诀阑 茄促.     * 措脚 捞矾茄 汲沥蔼甸篮 措何盒 荤侩磊喊肺 阿阿 历厘登绰 蔼捞骨肺,     * 荤侩磊啊 肺弊牢登绢乐瘤 臼促搁, 措何盒狼 亲格阑 disable 惑怕肺 父电促.	 */	private void processReady()	{		if( msnm.isLoggedIn() )		{			this.initFriendlyName = msnm.getOwner().getFormattedFriendlyName();			nickField.setText( initFriendlyName );			nickField.setEnabled( true );			loginCheck.setEnabled( true );			messageCheck.setEnabled( true );			fileAutoAcceptCheck.setEnabled( true );            tstampCheck.setEnabled( true );			emoticonCheck.setEnabled( true );			colorButton.setEnabled( true );			fixedFontFaceCheck.setEnabled( true );			findButton0.setEnabled( true );			findButton1.setEnabled( true );			findButton2.setEnabled( true );			photoChoose.setEnabled( true );			photoShowMe.setEnabled( true );			photoShowOther.setEnabled( true );		}		else		{			nickField.setText( Msg.get("label.login.please") );			nickField.setEnabled( false );			loginCheck.setEnabled( false );			messageCheck.setEnabled( false );			fileAutoAcceptCheck.setEnabled( false );            tstampCheck.setEnabled( false );			emoticonCheck.setEnabled( false );			colorButton.setEnabled( false );			fixedFontFaceCheck.setEnabled( false );			findButton0.setEnabled( false );			findButton1.setEnabled( false );			findButton2.setEnabled( false );			photoChoose.setEnabled( false );			photoShowMe.setEnabled( false );			photoShowOther.setEnabled( false );			return;		}		LocalCopy local = msnm.getLocalCopy();		boolean loginEnable = local.getPropertyBoolean(			MainFrame.SOUND_LOGIN_PROP + ".enable", true);		boolean messageEnable = local.getPropertyBoolean(			MainFrame.SOUND_MESSAGE_PROP + ".enable", true);		boolean fileAutoAccept = local.getPropertyBoolean(			MainFrame.AUTO_ACCEPT_FILE_PROP, false);        boolean tstampEnable = local.getPropertyBoolean(            MainFrame.TIMESTAMP_DISPLAY, false);		boolean emoticonEnable = local.getPropertyBoolean(			MainFrame.EMOTICON_DISPLAY, true);		boolean fixedFontEnable = local.getPropertyBoolean(			MainFrame.USE_FIXED_CHAT_FONT, false);		boolean autoNickEnable = local.getPropertyBoolean(			MainFrame.AUTONICK + ".enable", false );		boolean photoUse = local.getPropertyBoolean(			MainFrame.PHOTO_PROP_USE, false );		boolean photoOther = local.getPropertyBoolean(			MainFrame.PHOTO_PROP_SHOW, true );		loginCheck.setSelected( loginEnable );		messageCheck.setSelected( messageEnable );		fileAutoAcceptCheck.setSelected( fileAutoAccept );        tstampCheck.setSelected( tstampEnable );		emoticonCheck.setSelected( emoticonEnable );		fixedFontFaceCheck.setSelected( fixedFontEnable );		photoShowMe.setSelected( photoUse );		photoShowOther.setSelected( photoOther );		photoPath.setText( local.getProperty(MainFrame.PHOTO_PROP_LOCATION, "") );		if( photoUse )			useImage();		anStartButton.setEnabled( !autoNickEnable );		anStopButton.setEnabled( autoNickEnable );		String downdir = local.getProperty( MainFrame.DOWNLOAD_PROP );		String logdir = local.getProperty( MainFrame.CHATLOG_PROP );		String backImageFile = local.getProperty( MainFrame.BACKIMAGE_PROP, "" );		String autoNickPrefix = local.getProperty( MainFrame.AUTONICK + ".prefix", "" );		String autoNickPostfix = local.getProperty( MainFrame.AUTONICK + ".postfix", "" );		String autoNickPass = local.getProperty( MainFrame.AUTONICK + ".password", "jmsn");		new File(downdir).mkdirs();		new File(logdir).mkdirs();		downField.setText( downdir );		chatlogField.setText( logdir );		bgImageField.setText( backImageFile );		autoPrefixNickField.setText( autoNickPrefix );		autoPostfixNickField.setText( autoNickPostfix );		autoNickPassField.setText( autoNickPass );		String foreColor = local.getProperty( MainFrame.BUDDYLIST_FONT_COLOR, "000000" );		colorButton.setBackground( new Color(Integer.parseInt(foreColor)) );	}	public void setVisible( boolean show )	{		if( show )		{			processReady();		}		super.setVisible( show );	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -