ユーザーコントロールを作成して、パレットカテゴリを登録する


  テスト用のプロジェクトを作成( PaletteCategory )

新しい Java プロジェクトを作成して、ビジュアル・クラスを JFrame で作成します



JFrame 内の JPanel のレイアウト設定を null ( 位置指定 ) に変更します



  ユーザコントロール用パッケージを作成( myswing )




サンプルとして、JButton、JCheckBox、JRadioButton を継承したユーザーコントロールを作成し、
Bean の選択 で、Visual Editor 上で使用できる事を確かめます



  

package myswing;

import javax.swing.*;

@SuppressWarnings("serial")
public class LboxButton extends JButton {

	private int group;

	public int getLboxGroup() {

		return this.group;

	}

	public void setLboxGroup(int arg) {

		this.group = arg;

	}

	public void setLboxWidth(int width) {

		int height;

		height = this.getHeight();
		this.setSize(width,height);

	}
}
  

  

package myswing;

import javax.swing.*;

@SuppressWarnings("serial")
public class LboxCheck extends JCheckBox {

	private int group;

	public int getLboxGroup() {

		return this.group;

	}

	public void setLboxGroup(int arg) {

		this.group = arg;

	}

	public void setLboxCheck(boolean arg) {

		this.setSelected(arg);

	}

	public boolean getLboxCheck() {

		Object[] value;
		value = this.getSelectedObjects();

		if ( value == null ) {
			return false;
		}
		else {
			return true;
		}

	}

}
  

  

package myswing;

import javax.swing.*;

@SuppressWarnings("serial")
public class LboxRadio extends JRadioButton {

	private int group;

	public int getLboxGroup() {

		return this.group;

	}

	public void setLboxGroup(int arg) {

		this.group = arg;

	}

	public void setLboxCheck(boolean arg) {

		this.setSelected(arg);

	}

	public boolean getLboxCheck() {

		Object[] value;
		value = this.getSelectedObjects();

		if ( value == null ) {
			return false;
		}
		else {
			return true;
		}

	}

}
  

  myswing を jar ファイルとして エクスポート





この後、2回ダイアログが表示されますが、今回は何も設定する必要はありません。

  新しいプロジェクト( PaletteCategoryTest )を作成して、Bean として選択できる事を確認

今作成した myswing.jar を、Java プロジェクトを作成時に、「外部 JAR の追加」 で参照します


  パレットカテゴリが定義されている jar を解凍して、定義を記述

7zip で解凍しています

dropins\VisualEditor\eclipse\plugins\org.eclipse.ve.jfc_1.4.0.200807092330.jar

org.eclipse.ve.jfc_1.4.0.200807092330\palette\palette.properties
  

###############################################################################
# Copyright (c) 2003, 2005 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
# 
# Contributors:
#     IBM Corporation - initial API and implementation
###############################################################################
#
# $Source: /cvsroot/tools/org.eclipse.ve.jfc/palette/palette.properties,v $
# $Revision: 1.3 $  $Date: 2005/08/24 23:38:13 $
#


Palette.Category.AWTControls      = AWT Controls
Palette.Category.AWTMenus         = AWT Menus
Palette.Category.SwingContainers  = Swing Containers
Palette.Category.SwingComponents  = Swing Components
Palette.Category.SwingMenus       = Swing Menus
## ENTRY ##
Palette.Entry.JTableOnJScrollPane = JTable on JScrollPane
Palette.Category.LightboxComponents = lightbox
  

127行の次に以下を挿入
org.eclipse.ve.jfc_1.4.0.200807092330\palette\javavisualbeanscats.xmi
  

  <org.eclipse.ve.internal.cde.palette:Drawer icon16Name="platform:/plugin/org.eclipse.ve.jfc/icons/full/pal/swing_components.gif">
    <entryLabel xsi:type="org.eclipse.ve.internal.cde.utility:TranslatableString" key="Palette.Category.LightboxComponents"
        bundle="#bundle"/>
    <children xsi:type="org.eclipse.ve.internal.cde.palette:EMFCreationToolEntry" icon16Name="platform:/plugin/org.eclipse.ve.jfc/icons/full/clcl16/button_obj.gif"
        creationClassURI="java:/myswing#LboxButton">
      <entryLabel xsi:type="org.eclipse.ve.internal.cde.utility:ConstantString" string="LboxButton"/>
      <keyedValues xsi:type="ecore:EStringToStringMapEntry" key="org.eclipse.ve.internal.cde.core.nameincomposition"
          value="lboxButton"/>
    </children>
    <children xsi:type="org.eclipse.ve.internal.cde.palette:EMFCreationToolEntry" icon16Name="platform:/plugin/org.eclipse.ve.jfc/icons/full/clcl16/button_obj.gif"
        creationClassURI="java:/myswing#LboxCheck">
      <entryLabel xsi:type="org.eclipse.ve.internal.cde.utility:ConstantString" string="LboxCheck"/>
      <keyedValues xsi:type="ecore:EStringToStringMapEntry" key="org.eclipse.ve.internal.cde.core.nameincomposition"
          value="lboxCheck"/>
    </children>
    <children xsi:type="org.eclipse.ve.internal.cde.palette:EMFCreationToolEntry" icon16Name="platform:/plugin/org.eclipse.ve.jfc/icons/full/clcl16/button_obj.gif"
        creationClassURI="java:/myswing#LboxRadio">
      <entryLabel xsi:type="org.eclipse.ve.internal.cde.utility:ConstantString" string="LboxRadio"/>
      <keyedValues xsi:type="ecore:EStringToStringMapEntry" key="org.eclipse.ve.internal.cde.core.nameincomposition"
          value="lboxRadio"/>
    </children>
  </org.eclipse.ve.internal.cde.palette:Drawer>
  

  jar に変更部分を追加

Eclipse を終了して、dropins\VisualEditor\eclipse\plugins ディレクトリでコマンドプロンプトを開けて、以下を実行

  

"C:\Program Files\Java\jdk1.6.0_06\bin\jar" -uvf org.eclipse.ve.jfc_1.4.0.200807092330.jar -C org.eclipse.ve.jfc_1.4.0.200807092330 palette\javavisualbeanscats.xmi -C org.eclipse.ve.jfc_1.4.0.200807092330 palette\palette.properties
  


  Eclipse を clean 実行

eclipse.exe -clean.cmd を実行して下さい。




※ コントロール画像変えるのを忘れました・・・




yahoo  google  MSDN  MSDN(us)  WinFAQ  Win Howto  tohoho  ie_DHTML  vector  wdic  辞書  天気 


[javaSwing]
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
24/04/20 00:41:18
InfoBoard Version 1.00 : Language=Perl

1 BatchHelper COMprog CommonSpec Cprog CprogBase CprogSAMPLE CprogSTD CprogSTD2 CprogWinsock Cygwin GameScript HTML HTMLcss InstallShield InstallShieldFunc JScript JScriptSAMPLE Jsfuncs LLINK OldProg OracleGold OracleSilver PRO PRObrowser PROc PROconePOINT PROcontrol PROftpclient PROjscript PROmailer PROperl PROperlCHAT PROphp PROphpLesson PROphpLesson2 PROphpLesson3 PROphpfunction PROphpfunctionArray PROphpfunctionMisc PROphpfunctionString PROsql PROvb PROvbFunction PROvbString PROvbdbmtn PROvbonepoint PROwebapp PROwin1POINT PROwinSYSTEM PROwinYOROZU PROwindows ProjectBoard RealPHP ScriptAPP ScriptMaster VBRealtime Vsfuncs a1root access accreq adsi ajax amazon argus asp aspSample aspVarious aspdotnet aw2kinst cappvariety centura ckeyword classStyle cmaterial cmbin cmdbapp cmenum cmlang cmlistbox cmstd cmstdseed cmtxt cs daz3d db dbCommon dbaccess dnettool dos download flex2 flex3 flex4 framemtn framereq freeWorld freesoft gimp ginpro giodownload google hdml home hta htmlDom ie9svg install java javaSwing javascript jetsql jquery jsp jspTest jspVarious lightbox listasp listmsapi listmsie listmsiis listmsnt listmspatch listmsscript listmsvb listmsvc memo ms msde mysql netbeans oraPlsql oracle oracleWiper oraclehelper orafunc other panoramio pear perl personal pgdojo pgdojo_cal pgdojo_holiday pgdojo_idx pgdojo_ref pgdojo_req php phpVarious phpguide plsql postgres ps r205 realC realwebapp regex rgaki ruby rule sboard sc scprint scquest sdb sdbquest seesaa setup sh_Imagick sh_canvas sh_dotnet sh_google sh_tool sh_web shadowbox shgm shjquery shvbs shweb sjscript skadai skywalker smalltech sperl sqlq src systemdoc tcpip tegaki three toolbox twitter typeface usb useXML vb vbdb vbsfunc vbsguide vbsrc vpc wcsignup webanymind webappgen webclass webparts webtool webwsh win8 winofsql wmi work wp youtube