How to change attributes of Objects of all windows in a MDI application

Hi,
I have a MDI application to draw Object. In these MDI windows I can modify attributes of Object like color, size... Now I want to create an option, when the user change or modifies attribute of Objects in a window, so it allow to change attributes of objects in all windows. I don't know how I can do it, please help me. Thanks

Allow your objects to alias mutable attribute objects.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.util.*;
import javax.swing.*;
import java.util.List;
public class Example extends JPanel {
    private List bangles = new ArrayList();
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D) g;
        for(Iterator j=bangles.iterator(); j.hasNext(); )
            ((Bangle)j.next()).paint(g2);
    public void addBangle(Bangle bangle) {
        bangles.add(bangle);
        repaint();
    public static void main(String[] args) {
        JFrame.setDefaultLookAndFeelDecorated(true);
        JDialog.setDefaultLookAndFeelDecorated(true);
        Example app = new Example();
        JFrame f = new JFrame("Example");
        Container cp = f.getContentPane();
        cp.add(app, BorderLayout.CENTER);
        cp.add(Controller.create(app), BorderLayout.NORTH);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setSize(800,600);
        f.setLocationRelativeTo(null);
        f.setVisible(true);
class Controller {
    private Shade shade1 = new Shade(Color.GREEN), shade2 = new Shade(Color.RED), currentShade=shade1;
    private Example modelView;
    public static JComponent create(Example modelView) {
        return new Controller(modelView).createUI();
    private Controller(final Example modelView) {
        this.modelView = modelView;
        modelView.addMouseListener(new MouseAdapter(){
            public void mousePressed(MouseEvent evt) {
                Rectangle shape = new Rectangle(evt.getX(), evt.getY(), 20, 20);
                modelView.addBangle(new Bangle(shape, currentShade));
    private JComponent createUI() {
        ButtonGroup bg = new ButtonGroup();
        final JToolBar tb = new JToolBar();
        final JRadioButton rb1 = createRadio("Shade 1", true,  shade1, bg, tb);
        final JRadioButton rb2 = createRadio("Shade 2", false, shade2, bg, tb);
        JButton btn = new JButton("Change color of selected shade");
        btn.setContentAreaFilled(false);
        btn.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent evt) {
                Color newColor = JColorChooser.showDialog(tb, "Choose new color", currentShade.getColor());
                if (newColor != null) {
                    currentShade.setColor(newColor);
                    if (currentShade == shade1)
                        rb1.setForeground(newColor);
                    else
                        rb2.setForeground(newColor);
        tb.add(btn);
        return tb;
    private JRadioButton createRadio(String text, boolean selected, final Shade shade, ButtonGroup bg, JToolBar tb) {
        JRadioButton rb = new JRadioButton(text, selected);
        rb.setContentAreaFilled(false);
        rb.setForeground(shade.getColor());
        rb.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent evt) {
                currentShade = shade;
        tb.add(rb);
        return rb;
class Bangle {
    private Shape shape;
    private Shade shade;
    public Bangle(Shape shape, Shade shade) {
        this.shape = shape;
        this.shade = shade;
    public void paint(Graphics2D g2) {
        g2.setColor(shade.getColor());
        g2.draw(shape);
class Shade {
    private Color color;
    public Shade(Color color) {
        this.color = color;
    public Color getColor() {
        return color;
    public void setColor(Color color) {
        this.color = color;
}

Similar Messages

  • How can I change the grey colour of all window headings they're too hard to see?

    how can I change the grey colour of all window headings they're too hard to see?

    Hi Chris,
    The only way that I know of to change the colour of the window headings, these,
    is in the System Preferences > Universal Access > Seeing > Display and change the White on Black settings, using grey scale in there to helps, but it also opens a hole lot of other issues as it reverses all colours throughout the system. You can switch it back and forth as shown on this setup screen.
    Other than that, maybe changing the screen resolution so that all items are larger or zooming the screen when you require it by holding the Control button and scrolling the mouse or two finger scroll on the trackpad.
    There may be, of course, a third party app that changes the colours by searching google.
    Hope this helps

  • Apps open in a new window/space.. how do I turn this off so all windows open in "desktop"?

    Whenever I open an app it creates a new space to open the app in. All apps do this, and you can see the windows/spaces by hitting F3; the icons are lined up at the top of the screen. How do I disable this feature so all windows and apps open in the "desktop" space?

    OS X Yosemite: Work in multiple spaces

  • HT4946 how to change the back up location on windows 7,c drive is almost full

    how to change the back up location on windows 7,c drive is almost full

    This is not a feature of iTunes.
    See this thread for way to "trick" iTunes into backing up to a different location:
    https://discussions.apple.com/message/20590667#20590667

  • How to change default action "alarm" for all signatures ?

    My question belongs to a Cisco 1712 (128 MB, IOS 12.3T, SDM 2.5 installed):
    I'm trying to change the default action "alarm" to "alarm,reset,drop" for all signatures of my custom set.
    However doing so via SDM fails. First, it appears as being done correctly, but after compiling the signatures again, the default values are back there (in the same sense, I was unable to delete signatures, works just using the CLI).
    I followed the instructions at cisco.com:
    router(config)#ip ips signature-definition
    router(config-sigdef)#signature 6130 10
    router(config-sigdef-sig)#engine
    router(config-sigdef-sig-engine)#event-action produce-alert
    router(config-sigdef-sig-engine)#event-action deny-packet-inline
    router(config-sigdef-sig-engine)#event-action reset-tcp-connection
    router(config-sigdef-sig-engine)#exit
    However ip ips signature-definition is not understood by the router, so the procedure fails.
    Can you please assist me ?

    You can use IOS command-line interface (CLI) to change signature actions for one signature or a group of signatures based on signature categories. The following example shows how to change signature action to alert, drop and reset for signature 6130 with subsig ID of 10.
    router#configure terminal
    Enter configuration commands, one per line. End with CNTL/Z.
    router(config)#ip ips signature-definition
    router(config-sigdef)#signature 6130 10
    router(config-sigdef-sig)#engine
    router(config-sigdef-sig-engine)#event-action produce-alert
    router(config-sigdef-sig-engine)#event-action deny-packet-inline
    router(config-sigdef-sig-engine)#event-action reset-tcp-connection
    router(config-sigdef-sig-engine)#exit
    router(config-sigdef-sig)#exit
    router(config-sigdef)#exit
    Do you want to accept these changes? [confirm]y
    router(config)#

  • How to change drill filter values of all reports at the same time

    Hi,
    The Webintelligence users in our environment usuallly use drill filters in their document's reports. We'd like to find a way to change the drill filters' values of all reports when one value is selected. I mean, we need a work around to change the drill filters of all reports at the same time.
    We are using Business Objects XI 3.1 (a lot of webintelligence documents available, over than 2500).
    Does someone know a way to do that? I've already looked for that a lot, but I couldn't find anything.
    Thanks in advance,
    Gustavo Borges

    Hello Gustavo,
    as you refer to a Webi problem I recommend to post this query to the [BusinessObjects Web Intelligence|SAP BusinessObjects Web Intelligence; forum.
    This forum is dedicated to topics related to the creation and design of Web Intelligence documents using the Web Intelligence Report Panels. This includes areas such as universe connectivity, prompts, charting, formatting, filters, and formulas.
    It is monitored by qualified technicians and you will get a faster response there.
    Also, all Webi queries remain in one place and thus can be easily searched in one place.
    Best regards,
    Falk

  • Do you know how to change the Text Object for Billing Document?

    Hi,
    If you execute Transaction VOTX or VOTXn it will take you to Text Determination. The Billing Doc & Sales Document both has the VBBK as Text Object for me and is it like that for all.
    I need to change the Text Object to VBRK for Billing Doc, which is the ideal because I am using the Function Module READ_TEXT to retrieve text. This work perfectly for Sales Document which has VBBK as Text Object, but does not work for Billing Doc where it through as error message saying “Text 0020000021 ID 0002 language EN not found”.
    Thank You
    Kishan

    Hi kishan,
    For updating these text you can use FM 'SAVE_TEXT'.
    As for your problem, to get the parameter you need, go to the billing document, go to the text, and display it in plain page mode.
    Then you do 'GO TO' -> 'HEADER', and a pop-up window open with the parameters you need Obect type, ID, Name, ...
    Regards,
    Erwan.

  • How to change the local decimal separator on windows xp OS ?

    Hi all,
    I would like to known how to change programmatically with LV8.5 the local decimal separator ? I want to force this parameter to the point separator, so to be sure that it's not the comma (if it's the comma when installing the executable, the ascii files are not read properly).
    Thanks.
    Wilfried.

    GerdW wrote:
    Hi Wilfried,
    you can use the format code "%.;" to get points as decimal separator in each string formatting function.
    This is the important one. Put it at the beginning of every format specifier!
    Some functions have a boolean control 'use local decimator' make sure this is 'F'
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How to change default texts in OSX dialogue windows?

    I'd like to change some of the texts that appear in the OSX dialogue boxes.
    One example: I have set my Mac up to ask for the password after N minutes of sleep. I would like to change the text in the box/window that appears when the Mac is woken up and where you are told to submit your ID and password (I'm sorry that I am not sure what exactly it says in English because I'm using another language).
    The closest thing to what I need I have come across is this:
    sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText 'Hands off'
    However, this applies only to the first login window you see after you have started the computer. I'd like to change other default texts as well.
    The default texts in different languages must be stored somewhere. How do I find them and how do I chage them? Any advice would be appreciated.

    It seems like the same problem as would be faced by someone localizing the OS, so perhaps there would be something useful here:
    http://developer.apple.com/internationalization/

  • How to get names of all Windows in a Form Application at runtime

    Dear All,
    I want to get the name of all windows in a form module programatically at run time. How to get it?
    Any help or comments will be highly appreciated.
    Thanks in Advance.
    Best Regards
    Bilal

    Hi Francois Degrelle,
    First of all thanks for the response.
    What if I have no items on a content canvas? In my application, I am using content canvas to hold the Image banner and help text of the current form, having no items at all. I am also using tab canvases to hold all items of form. The tabs are displayed on the content canvas at run time. So the tab canvases acts like frames (In my case).
    Now if I am looping through items, it gives me the list of all of the tab canvases. Whereas the tab canvas always has no window assigned, as it is displayed on content canvas which has that Window which I need. Thus I am unable to get the names of windows in my case through the above stated procedure.
    Another option could be if I can get the name of the content canvas upon which the given tab canvas is displayed?
    Any way to do this or some other way to achieve the use case?
    Any help will be highly appreciated.
    Thanks in advance
    Bilal

  • Change the Show View Options' "All windows" default to "This window only"?

    By default, all Show View Options panes are set to "All windows". Is it possible to change the default to "This window only"?
    I regularly change icon sizes for various folders, but never for all windows. So every time that I use the Show View Options pane, it's an annoying "click This window only" process.
    screen capture of Show View Options pane
    http://aycu01.webshots.com/image/11080/2003481958008021751_rs.jpg
    17" iMac G4, 1GHz PowerPC, 768mb RAM Mac OS X (10.4.9)

    The default is for any window you have not previously opened and set to have All Windows as the default, for List and Icon Views. Once you click This Window Only and make your settings, then every time you open that particular folder it should remain at the This Window setting.
    I find the default of All Windows really really annoying, but I am aware of no way to change this. Send Feedback to Apple:
    http://www.apple.com/macosx/feedback/
    It should be a user settable global preference, but it isn't.
    Francine
    Francine
    Schwieder

  • How to change the font in query builder window in Reports 6i?

    Hi
    I am facing the old problem again and again, which is I can not find any way to change the font in query builder window in Reports 6i. The current font is so bad for alignment and ordering each part of SELECT statement. Is there any way to change this to COURIER NEW for example?

    No, but I suggest using a different editor which does allow a different text option and just pasting it in.

  • How to change attributs of a piece of Document ?

    Hello,
    I have a JTextPane and a Document which has inherited of DefaultStyleDocument.
    When the user has selected a piece of the text, I want to make him changes a few attributs
    I looked at the sample TextComponentDemo, but all attributs are specified in menu items (so they are quite static).
    In fact, users want to :
    1. Select part of the text
    2. Click on a menu item for example "Change Color" which invokes the JColorChooser Class
    3. change the text after having selected a color.
    More generally, this applies also to font name from the font family, font syle and font size.
    I noticed that there is a class name AttributSet, but I don't know how to manipulate this set (especially where to find attribut names).
    Thanks in advance for suggestions, examples, or pointers to good documentations
    Gege

    but all attributs are specified in menu items (so they are quite static).Yes, but the Action is created using a color Object. So just create an action using the color selected from the JColorChooser and then invoke its actionPerformed() method:
    Action foreground = new StyledEditorKit.ForegroundAction("", colorFromColorChooser);
    foreground.actionPerformed(null);

  • How to change attributes of multiple devices ?

    This is something I thought would be straightforward but for the life of me I can not see how is it done in ZCM. I just want to set a property for a number of devices - based on a manual selection or maybe search results. E.g. I would like to set a location for all devices added on a given day. I can easily do a search to bring up a list of the devices but can not see a way to set an attribute for those. Am I missing something obvious here ?
    While on it, is it possible to set device attributes from bundles ? E.g. as a part of post-imaging process I would like to set the location or the department for that device from a linked bundle.

    Originally Posted by atrofimov
    This is something I thought would be straightforward but for the life of me I can not see how is it done in ZCM. I just want to set a property for a number of devices - based on a manual selection or maybe search results. E.g. I would like to set a location for all devices added on a given day. I can easily do a search to bring up a list of the devices but can not see a way to set an attribute for those. Am I missing something obvious here ?
    Guys, "cannot be done" would still be a valid answer :) I doubt it can't be done, after all it seems to me like a pretty basic feature. I would even be happy to change the attribute for a group of devices - e.g. create a dynamic group then change location for the members .. but I can't see a way of doing that either.

  • How to change attribute "read_only" of a inputfield in a table?

    Hi, experts,
    action:
    1.Create a table with name " A_TABLE" in the layout in a view.
    2.Binding some fields from a structure to the table.
    3.Field "Checkbox" is a checkbox type and field "input" is a inputfield type with readonly in the table "A_TABLE" .
    4.I hope: When selecting a checkbox in the "Checkbox" colume in a row in the table, the field "input"  corresponding will be changed readonly.
    The follow is my code: When select Field "Checkbox" , the method is invoked.
    method ONACTIONCLICK4DISDESC .
       data view           type ref to if_wd_view.
       DATA input_desc     TYPE REF TO CL_WD_INPUT_FIELD.
       data tab            type if_BIDDING_LIST_VIEW=>elements_ONSURVEY.
       data struct         type if_BIDDING_LIST_VIEW=>element_ONSURVEY.
    I have set "wd_this->m_view = view" in the method wddomodify and add m_view to the attribute of the
      "viewBIDDING_LIST_VIEW" .
       view ?= wd_this->m_view.
       input_desc ?= view->GET_ELEMENT( `TABLE_INPUT_EDITOR` ).
       input_desc->SET_READ_ONLY(  EXPORTING  value = abap_false ).
    endmethod.
    result:
    when I select a checkbox in the "Checkbox" colume in a row in the table, all field "input" is read and write.
    How can I do it ?
    Best regards,
    tao

    Hello Wang,
    You need to bind the readOnly attribute of the input field to a newly to created attribute beneath the dataSource node of the table within the context. That way, each input field of each row of the table can have a different value for readOnly.
    Best regards,
    Thomas

Maybe you are looking for

  • Confirmation of Accounts

    Hi ALL According to my client requirement i need a report ...Confirmation of Accounts report in which the user can see the Debit and Credit values of a BP for a particular period Can anyone please give any solution for this Thanks

  • Free goods accounting

    dear all, We are facing one problem in free goods scenario. i.e: higher level line item is a sale and values are passing to accounts.but free goods for the higher level line item is not a sale it s issued as free. now question is whether free good it

  • How to combine a content search with an attribute search with the API

    Hi I have been working with searches in Content Services using the API and I have successfully set up the search over the contents of a document and inside of the Category attributes of the document. My problem comes when I try to combine this 2 kind

  • Mark(highlight, bold, and so on) text in GWT (for help)

    I want to display a paragraph text in GWT, in some component(TextArea, or RichTextArea...), and then double-click the words in the text to select them. Now I want to highlight the words, can GWT support that effects I need? I have tried to use TextAr

  • Order # for a particular Delivery #

    Dear All, How can I know the particular order # for a particular Delivery/Picking #? All helpful answers will be rewarded. Regards Renjan