Show Notification Message to all the Users based on IP Address in Java? -
i want show notification message (using java frame
) users machine based on ip address.
how create frame
in users machine, please me.
i created frame
, code below:
string message = "you got new notification message. not awesome have such notification message."; string header = "this header of notification message"; jframe frame = new jframe(); frame.setsize(300, 125); frame.setundecorated(true); frame.setlayout(new gridbaglayout()); gridbagconstraints constraints = new gridbagconstraints(); constraints.gridx = 0; constraints.gridy = 0; constraints.weightx = 1.0f; constraints.weighty = 1.0f; constraints.insets = new insets(5, 5, 5, 5); constraints.fill = gridbagconstraints.both; jlabel headinglabel = new jlabel("<html><font color = 'red'>"+header); //headinglabel.seticon(headingicon); // --- use image icon want heading image. headinglabel.setopaque(false); frame.add(headinglabel, constraints); constraints.gridx++; constraints.weightx = 0f; constraints.weighty = 0f; constraints.fill = gridbagconstraints.none; constraints.anchor = gridbagconstraints.north; jbutton cloesbutton = new jbutton(new abstractaction("x") { @override public void actionperformed(actionevent e) { frame.dispose(); } }); cloesbutton.setmargin(new insets(1, 4, 1, 4)); cloesbutton.setfocusable(false); frame.add(cloesbutton, constraints); constraints.gridx = 0; constraints.gridy++; constraints.weightx = 1.0f; constraints.weighty = 1.0f; constraints.insets = new insets(5, 5, 5, 5); constraints.fill = gridbagconstraints.both; jlabel messagelabel = new jlabel("<html><font color = 'red'>" + message); frame.add(messagelabel, constraints); frame.setdefaultcloseoperation(windowconstants.exit_on_close); dimension scrsize = toolkit.getdefaulttoolkit().getscreensize();// size of screen insets toolheight = toolkit.getdefaulttoolkit().getscreeninsets(frame.getgraphicsconfiguration());// height of task bar frame.setlocation(scrsize.width - frame.getwidth(), scrsize.height - toolheight.bottom - frame.getheight()); frame.setvisible(true); frame.setalwaysontop(true);
thanks in advance.
Comments
Post a Comment