由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Swing help
相关主题
一个基本问题。新手问个multi-threading关于synchronized和volatile的问题
Re: component之间怎样送消息?问个gwt client code调用远程object的问题
how to set java run time locale/encoding?Re: Can create a Interface object, why?
Re: Swing ButtonRe: print problem, GUI guru please come in
大家用swing还是swt呀?农民运动讲习所1. Thread and paint()
发现 synchronized 的一个问题Talk a little more about How to lock a file
synchronization for countersHow higlight a point by clicking a radio
synchronization 锁住了什么?swing question
相关话题的讨论汇总
话题: swing话题: create话题: buttons话题: able
进入Java版参与讨论
1 (共1页)
c*****t
发帖数: 1879
1
I could like to create JToggleButon and JCheckboxMenuItem based on
a single action and being able to synchronize their states. Is it
possible? It seemed very tedious to me since I'd like to create
buttons/menus from script and being able to group actions (buttons
and menu items then would automatically inherit it).
Anyone has done it before? Thanks.
n*****k
发帖数: 123
2

I do not really understand what are you trying to accomplish. But I will try
to answer it anyway.
First you can either create a common ActionListener or use a class that
implements ActoinListener interface for that purpose, after you creating
JToggleButton and JCheckboxMenuItem, do not forget to calle their
addActionListener method to add the common one to their listener list, also
add them to an ArrayList or whatever collection you want to use, so that you
can remember how many of them need to

【在 c*****t 的大作中提到】
: I could like to create JToggleButon and JCheckboxMenuItem based on
: a single action and being able to synchronize their states. Is it
: possible? It seemed very tedious to me since I'd like to create
: buttons/menus from script and being able to group actions (buttons
: and menu items then would automatically inherit it).
: Anyone has done it before? Thanks.

c*****t
发帖数: 1879
3
Great. The later method you mentioned is exactly what I needed.

【在 n*****k 的大作中提到】
:
: I do not really understand what are you trying to accomplish. But I will try
: to answer it anyway.
: First you can either create a common ActionListener or use a class that
: implements ActoinListener interface for that purpose, after you creating
: JToggleButton and JCheckboxMenuItem, do not forget to calle their
: addActionListener method to add the common one to their listener list, also
: add them to an ArrayList or whatever collection you want to use, so that you
: can remember how many of them need to

1 (共1页)
进入Java版参与讨论
相关主题
swing question大家用swing还是swt呀?
add a mouse-click function on an applet发现 synchronized 的一个问题
Anybody can recommend a framework article for building swinsynchronization for counters
请教一个多线程lock机制的问题synchronization 锁住了什么?
一个基本问题。新手问个multi-threading关于synchronized和volatile的问题
Re: component之间怎样送消息?问个gwt client code调用远程object的问题
how to set java run time locale/encoding?Re: Can create a Interface object, why?
Re: Swing ButtonRe: print problem, GUI guru please come in
相关话题的讨论汇总
话题: swing话题: create话题: buttons话题: able