From: Tom N. <tho...@gm...> - 2014-01-28 13:48:27
|
You may need to do something like this: http://stackoverflow.com/questions/5661556/jcombobox-setting-label-and-value After you create the GraphMouse, you can call getModeComboBox, then set the listCellRendererComponent to internationalize the labels for you. Tom On Tue, Jan 28, 2014 at 7:24 AM, Frédéric Vergnaud < fre...@mi...> wrote: > I've tried to extends AbstractModalGraphMouse in a > myAbstractModalGraphMouse class > I'm forced to implement loadPlugins(), that is the only abstract void) and > I've looked over AbstractModalGraphMouse, and I found that getModeMenu() is > not abstract, so I can't rewrite it ... > So did you mean directly in YOUR code in AbstractModalGraphMouse.java ? > Is there not a better way ? > > > Le 28/01/14 10:50, Tom Nelson a écrit : > > sorry, I meant the JRadioButtonMenuItem constructor > > > On Tue, Jan 28, 2014 at 4:49 AM, Tom Nelson <tho...@gm...>wrote: > >> Override getModeMenu() in AbstractModalGraphMouse. >> Change only the JRadioButton constructor to assign the names you want. >> >> Tom Nelson >> >> >> On Tue, Jan 28, 2014 at 4:27 AM, Frédéric Vergnaud < >> fre...@mi...> wrote: >> >>> Unfortunately, I think the Enum you pointed me are not the texts >>> showed in the combobox, but the actions to specify by ie : >>> >>> graphMouse.setMode(ModalGraphMouse.Mode.PICKING) >>> >>> So if I modify this Enum, I'd have to modify the mode calls ... not a >>> good idea ! >>> >>> I've tried this : >>> >>> final DefaultModalGraphMouse<Vertex, Edge> graphMouse = new >>> DefaultModalGraphMouse<Vertex, Edge>(); >>> JMenu menuMouseComboBox = graphMouse.getModeMenu(); >>> Component[] comps = menuMouseComboBox.getMenuComponents(); >>> JRadioButtonMenuItem menu1 = (JRadioButtonMenuItem) comps[0]; >>> System.out.println(menu1 + " :: " + menu1.getText()); >>> JRadioButtonMenuItem menu2 = (JRadioButtonMenuItem) comps[1]; >>> System.out.println(menu2 + " :: " + menu2.getText()); >>> >>> wich outputs : >>> >>> javax.swing.JRadioButtonMenuItem[... text=TRANSFORMING] :: TRANSFORMING >>> javax.swing.JRadioButtonMenuItem[... text=PICKING] :: PICKING >>> >>> >>> So I did : >>> >>> menu1.setText("Toto"); >>> menu2.setText("Titi"); >>> >>> But it does'nt work ... >>> >>> Any idea ? >>> >>> >>> >>> Le 27/01/14 19:36, Joshua O'Madadhain a écrit : >>> >>> Those words are, I believe, taken from the enum definition, which >>> defines those two modes: >>> >>> https://code.google.com/p/jung/source/browse/trunk/jung/jung-visualization/src/main/java/edu/uci/ics/jung/visualization/control/ModalGraphMouse.java >>> >>> The code probably just uses the name of the enum member for the >>> combobox rather than trying to do anything more sophisticated. >>> >>> So, two options: >>> (0) Find the place where the combobox decides what to render, and add a >>> translation of the enum into the text you desire. >>> (1) Change the names of those enums in the code. >>> >>> Hope this helps. >>> >>> >>> On Mon, Jan 27, 2014 at 6:32 AM, Frédéric Vergnaud < >>> fre...@mi...> wrote: >>> >>>> Hi all ! >>>> Is it possible to modify the text within the graphmouse combobox, ie >>>> change "TRANSFORMING" & "PICKING" by french words, and how to do that ? >>>> Thank you for your support ! >>>> Regards. >>>> Fred >>>> >>>> -- >>>> Frédéric Vergnaud >>>> CNRS UMR 7185 >>>> Centre de Sociologie de l'Innovation - Ecole des Mines de Paris >>>> 60, Boulevard Saint Michel , 75272 Paris Cedex 06 >>>> Tél 33(0)1.40.51.92.83 | Fax 33(0)43.54.56.28 >>>> http://www.csi.mines-paristech.fr >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> CenturyLink Cloud: The Leader in Enterprise Cloud Services. >>>> Learn Why More Businesses Are Choosing CenturyLink Cloud For >>>> Critical Workloads, Development Environments & Everything In Between. >>>> Get a Quote or Start a Free Trial Today. >>>> >>>> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk >>>> _______________________________________________ >>>> Jung-support mailing list >>>> Jun...@li... >>>> https://lists.sourceforge.net/lists/listinfo/jung-support >>>> >>> >>> >>> >>> -- >>> jos...@gm.........sites.google.com/site/joshuaomadadhain/ >>> Joshua O'Madadhain: Information Scientist, Musician, >>> Philosopher-At-Tall >>> It's that moment of dawning comprehension that I live for. -- Bill >>> Watterson >>> My opinions are too rational and insightful to be those of any >>> organization. >>> >>> >>> -- >>> Frédéric Vergnaud >>> CNRS UMR 7185 >>> Centre de Sociologie de l'Innovation - Ecole des Mines de Paris >>> 60, Boulevard Saint Michel , 75272 Paris Cedex 06 >>> Tél 33(0)1.40.51.92.83 | Fax 33(0)43.54.56.28http://www.csi.mines-paristech.fr >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> WatchGuard Dimension instantly turns raw network data into actionable >>> security intelligence. It gives you real-time visual feedback on key >>> security issues and trends. Skip the complicated setup - simply import >>> a virtual appliance and go from zero to informed in seconds. >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk >>> >>> _______________________________________________ >>> Jung-support mailing list >>> Jun...@li... >>> https://lists.sourceforge.net/lists/listinfo/jung-support >>> >>> >> > > -- > Frédéric Vergnaud > CNRS UMR 7185 > Centre de Sociologie de l'Innovation - Ecole des Mines de Paris > 60, Boulevard Saint Michel , 75272 Paris Cedex 06 > Tél 33(0)1.40.51.92.83 | Fax 33(0)43.54.56.28http://www.csi.mines-paristech.fr > > |