input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public void add to selection all figure enumeration fe while fe has more elements add to selection fe next figure
|
adds a figure enumeration to the current selection
|
public void read storable input dr throws ioexception set layoutable layoutable dr read storable
|
reads the contained figures from storable input
|
public void write storable output dw dw write storable get layoutable
|
writes the contained figures to the storable output
|
protected jmenu create debug menu command menu menu new command menu debug command cmd new abstract command simple update this public void executable this view set display update new simple update strategy menu add cmd cmd new abstract command buffered update this public void executable this view set display update new buffered update strategy menu add cmd return menu
|
creates the debug menu
|
protected void set text string new text figure enumeration fe get affected figures while fe has more elements figure current figure fe next figure if current figure instanceof text holder text holder current figure set text new text
|
sets the text attribute of the undo activity
|
public void remove from selection figure figure if is figure selected figure f selection remove element figure f selection handles null figure invalidate fire selection changed
|
removes a figure from the selection
|
public void drawing invalidated drawing change event e rectangle r e get invalidated rectangle if damaged area null damaged area r else damaged area add r
|
overridden to accumulate damage in an instance variable of this class
|
public void toggle selection figure figure if is figure selected figure remove from selection figure else add to selection figure fire selection changed
|
if a figure isnt selected it is added to the selection
|
protected jcomponent create contents drawing view view if view is interactive mdi internal frame internal frame create internal frame view jcomponent contents super create contents view internal frame get content pane add contents get desktop add internal frame internal frame set visible true try internal frame set selected true catch java beans property veto exception e ignore return container in which the internal frame is embedded return get desktop
|
creates the contents component of the application
|
public void prompt new if has internal frames super prompt new else new window create drawing
|
resets the drawing to a new empty drawing
|
public void new window drawing new drawing drawing view new view create drawing view new view set drawing new drawing create contents new view tool done
|
method to create a new internal frame
|
public void clear selection there is nothing selected if f selection handles null avoid unnecessary selection changed event when nothing has to be cleared return figure enumeration fe selection elements while fe has more elements fe next figure invalidate f selection new vector f selection handles null fire selection changed
|
clears the current selection
|
public void mouse down mouse event e int x int y is popup trigger at mouse down is only notified at unix systems if e is popup trigger handle popup menu e x y else super mouse down e x y handle mouse down e x y
|
mouse listener method for mouse down events
|
protected void set desktop jcomponent new desktop desktop new desktop
|
set the component in which the content is embedded
|
public void mouse up mouse event e int x int y if e is popup trigger handle popup menu e x y patch jhot draw 5 4b1 super mouse up e x y else if e get click count 2 patch jhot draw 5 4b1 super mouse up e x y handle mouse double click e x y else super mouse up e x y handle mouse up e x y handle mouse click e x y
|
mouse listener method for mouse up events
|
private enumeration selection handles if f selection handles null f selection handles new vector figure enumeration k selection elements while k has more elements figure figure k next figure enumeration kk figure handles elements while kk has more elements f selection handles add element kk next element return f selection handles elements
|
gets an enumeration of the currently active handles
|
public void add internal frame listener internal frame listener new mdilistener mdi listeners add element new mdilistener
|
add a new listener to the applications internal frames
|
public void remove internal frame listener internal frame listener old mdilistener mdi listeners remove element old mdilistener
|
remove a internal frame listeners from the application
|
private void create drag gesture recognizer drawing view dv drag gesture listener dgl if component class is instance dv component c component dv drag gesture recognizer dgr drag source create default drag gesture recognizer c dn dconstants action copy or move this f drag gesture recognizers add dgr
|
used to create the gesture recognizer which in effect turns on draggability
|
protected jmenu create color menu string title string attribute command menu menu new command menu title for int i 0 i color map size i menu add new undoable command new change attribute command color map name i attribute color map color i this return menu
|
creates the color menu
|
public void activate frame mdi internal frame new frame if current frame new frame check whether drawing has been already initialised if new frame get drawing view drawing null new frame get drawing view unfreeze view if current frame null current frame get drawing view freeze view current frame get drawing view clear selection current frame new frame set view current frame get drawing view
|
activate an internal frame upon which the selected tools operate
|
public figure selection get figure selection return new standard figure selection new figure enumerator selection zordered selection count
|
gets the current selection as a figure selection
|
protected void handle popup menu mouse event e int x int y figure figure drawing find figure e get x e get y if figure null object attribute figure get attribute figure popup menu if attribute null figure drawing find figure inside e get x e get y if figure null show popup menu figure e get x e get y e get component
|
hook method which can be overriden by subclasses to provide
|
public void deactivate frame mdi internal frame frame if current frame frame current frame null
|
if the frame we are deactivating is the current frame set the
|
public void internal frame activated internal frame event e activate frame mdi internal frame e get source
|
notification method from internal frame listener which is called
|
private void adjust offsets component comp point offset point if comp null point comp location comp get location offset point translate comp location x comp location y adjust offsets comp get parent offset point
|
internal mdi frames have offsets where a popup menu should be
|
private void destroy drag gestre recognizer drawing view dv drag gesture listener dgl iterator i f drag gesture recognizers iterator while i has next drag gesture recognizer dgr drag gesture recognizer i next if dgr get component dv dgr remove drag gesture listener this dgr set component null i remove break
|
used to destroy the gesture listener which ineffect turns off dragability
|
public void internal frame closing internal frame event e mdi internal frame mdf mdi internal frame e get source drawing view dv mdf get drawing view fire view destroying event dv if mdf current frame current frame null set view null drawing view get managed drawing view this
|
notification method from internal frame listener which is called
|
public handle find handle int x int y handle handle enumeration k selection handles while k has more elements handle handle k next element if handle contains point x y return handle return null
|
finds a handle at the given coordinates
|
public void internal frame deiconified internal frame event e activate frame mdi internal frame e get source
|
notification method from internal frame listener which is called
|
public void internal frame deactivated internal frame event e deactivate frame mdi internal frame e get source
|
notification method from internal frame listener which is called
|
protected void fire selection changed if f selection listeners null for int i 0 i f selection listeners size i figure selection listener l figure selection listener f selection listeners element at i l figure selection changed this
|
informs that the current selection changed
|
protected jmenu create font menu command menu menu new command menu font string fonts toolkit get default toolkit get font list for int i 0 i fonts length i menu add new undoable command new change attribute command fonts i font name fonts i this return menu
|
creates the fonts menus
|
public void set font font new font will change f font new font mark size dirty mark font dirty attributes map new hashtable 1 attributes map put text attribute font new font changed
|
sets the font
|
public void drag enter drop target drag event dtde system out println drop target drag event drag enter support drop target drag event dtde
|
called when a drag operation has encountered the drop target
|
protected void set drawing title string new drawing title current frame set title get application name new drawing title
|
set the title for the drawing
|
public void activate tools if needs update return else remove all jcomponent current tool null enumeration enum current tools elements while enum has more elements current tool jcomponent enum next element super add current tool validate needs update false
|
activate a palette of the tool bar by setting all tools
|
public component add component new tool if current tools edit tools edit tools add element new tool else standard tools add element new tool needs update true return super add new tool
|
add a new tool the the current palette of the tool bar
|
protected void initialize set layouter new standard layouter this
|
this method performs additional initialization operations
|
protected string get drawing title return current frame get drawing get title
|
get the title for the drawing
|
protected jmenu create font style menu command menu menu new command menu font style menu add new undoable command new change attribute command plain font style new integer font plain this menu add new undoable command new change attribute command italic font style new integer font italic this menu add new undoable command new change attribute command bold font style new integer font bold this return menu
|
creates the font style menu with entries plain italic bold
|
public void basic display box point origin point corner rectangle r get layouter layout origin corner get presentation figure basic display box r get location new point r width r height
|
standard presentation method which is delegated to the encapsulated presentation figure
|
public void action figure figure figure replace figure drawing replace figure new border decorator figure set undo activity create undo activity vector v new vector v add element figure v add element new border decorator figure get undo activity set affected figures new figure enumerator v border tool undo activity get undo activity replace affected figures
|
decorates the clicked figure with a border
|
public void drag over drop target drag event dtde support drop target drag event dtde
|
called when a drag operation is ongoing on the drop target
|
public vector handles return get presentation figure handles
|
return default handles from the presentation figure
|
protected jmenu create font size menu command menu menu new command menu font size int sizes 9 10 12 14 18 24 36 48 72 for int i 0 i sizes length i menu add new undoable command new change attribute command integer to string sizes i font size new integer sizes i this return menu
|
creates the font size menu
|
protected undoable create undo activity return new group command undo activity view
|
factory method for undo activity
|
public vector handles vector handles new vector box handle kit add handles this handles return handles list handles collections factory current create list box handle kit add handles this handles return new handle enumerator handles
|
returns an iterator of standard sizing handles to manipulate the figure
|
public void drop action changed drop target drag event dtde system out println drop target drag event drop action changed support drop target drag event dtde
|
called if the user has modified the current drop gesture
|
public void figure invalidated figure change event e rectangle rect e get invalidated rectangle rect grow get border offset x get border offset y super figure invalidated new figure change event e get figure rect
|
invalidates the figure extended by its border
|
public void add point int x int y f points add element new point x y changed
|
adds a node to the list of points
|
protected point constrain point point p constrin to view size dimension size get size p x math min size width math max 1 p x p y math min size height math max 1 p y p x geom range 1 size width p x p y geom range 1 size height p y if f constrainer null return f constrainer constrain point p return p
|
constrains a point to the current grid
|
public void figure request remove figure change event e if listener null if includes e get figure listener figure request remove new figure change event e get figure e get invalidated rectangle else super figure request remove e
|
propagates the remove from drawing request up to the container
|
public void write storable output dw super write dw dw write int f display box x dw write int f display box y dw write int f display box width dw write int f display box height dw write string f file name
|
writes the image figure to a storable output
|
private void start sleeper if f sleeper null f sleeper new sleeper thread this f sleeper start
|
netscape browser work around
|
public void read storable input dr throws ioexception super read dr f display box new rectangle dr read int dr read int dr read int dr read int f file name dr read string iconkit instance register image f file name
|
reads the image figure from a storable input
|
public void read storable input dr throws ioexception super read dr set presentation figure figure dr read storable
|
reads the contained figures from storable input
|
public void set point at point p int i will change f points set element at p i changed
|
changes the position of a node
|
public void key pressed key event e int code e get key code if code key event vk back space code key event vk delete command cmd new undoable command new delete command delete editor cmd view selection changed this if cmd is executable cmd execute else if code key event vk down code key event vk up code key event vk right code key event vk left handle cursor key code else tool key down e code check damage
|
handles key down events
|
public void write storable output dw super write dw dw write storable get presentation figure
|
writes the contained figures to the storable output
|
public void insert point at point p int i f points insert element at p i changed
|
insert a node at the given point
|
public void mouse down mouse event e int x int y super mouse down e x y figure pressed figure drawing find figure inside x y text holder text holder get typing target if f connected pressed figure null text holder null pressed figure text holder text holder connect pressed figure connected text tool undo activity get undo activity set connected figure pressed figure f connected true
|
if the pressed figure is a text holder it can be edited otherwise
|
public void activate super activate f connected false
|
if the pressed figure is a text holder it can be edited otherwise
|
public void write storable output dw dw write double get angle dw write double get outer radius dw write double get inner radius super write dw
|
stores the arrow tip to a storable output
|
public rectangle display box figure enumeration fe figures rectangle r fe next figure display box while fe has more elements r add fe next figure display box return r
|
gets the display box
|
protected undoable create undo activity return new connected text tool undo activity view get typing target get text
|
factory method for undo activity
|
public void read storable input dr throws ioexception set angle dr read double set outer radius dr read double set inner radius dr read double super read dr
|
reads the arrow tip from a storable input
|
public vector handles vector handles new vector handles add element new group handle this relative locator north west handles add element new group handle this relative locator north east handles add element new group handle this relative locator south west handles add element new group handle this relative locator south east return handles
|
gets the handles for the group figure
|
public void set attribute string name object value super set attribute name value figure enumeration k figures while k has more elements k next figure set attribute name value
|
sets the attribute of all the contained figures
|
public void draw graphics g int x1 int y1 int x2 int y2 tbd reuse the polygon object polygon p outline x1 y1 x2 y2 if get fill color null g fill polygon p xpoints p ypoints p npoints else color draw color g get color g set color get fill color g fill polygon p xpoints p ypoints p npoints g set color draw color if get border color get fill color color draw color g get color g set color get border color g draw polygon p xpoints p ypoints p npoints g set color draw color
|
draws the arrow tip in the direction specified by the given two
|
public void write storable output dw if get fill color null figure attributes write color dw fill color get fill color else dw write string no fill color if get border color null figure attributes write color dw border color get border color else dw write string no border color
|
stores the arrow tip to a storable output
|
public void read storable input dr throws ioexception string fill color id dr read string read color only if one has been written if fill color id equals fill color set fill color figure attributes read color dr string border color id dr read string read color only if one has been written if border color id equals border color set border color figure attributes read color dr
|
reads the arrow tip from a storable input
|
protected void create tools jtool bar palette tool tool create selection tool f default tool button create tool button images sel selection tool tool palette add f default tool button
|
creates the tools
|
protected void basic move by int dx int dy don t move the start and end point since they are connected for int i 1 i f points size 1 i point f points element at i translate dx dy update connection make sure that we are still connected
|
ensures that a connection is updated if the connection
|
public void connect start connector new start connector set start connector new start connector start figure add figure change listener this
|
sets the start figure of the connection
|
public vector handles vector handles new vector f points size 2 handles add element new change connection start handle this for int i 1 i f points size 1 i handles add element new null handle this locator i handles add element new change connection end handle this for int i 0 i f points size 1 i handles add element new elbow handle this i return handles
|
gets the handles of the figure
|
public void connect end connector new end connector set end connector new end connector end figure add figure change listener this handle connect start figure end figure
|
sets the end figure of the connection
|
public void disconnect start start figure remove figure change listener this set start connector null
|
disconnects the start figure
|
public void disconnect end handle disconnect start figure end figure end figure remove figure change listener this set end connector null
|
disconnects the end figure
|
public int find segment int x int y point p1 p2 for int i 0 i f points size 1 i p1 point f points element at i p2 point f points element at i 1 if geom line contains point p1 x p1 y p2 x p2 y x y return i return 1
|
gets the segment of the polyline that is hit by
|
public void activate super activate view clear selection jdk1 1 text cursor has an incorrect hot spot view set cursor cursor get predefined cursor cursor text cursor
|
sets the text cursor
|
public object get attribute string name if name equals frame color return get frame color else if name equals arrow mode int value 0 if get start decoration null value arrow tip start if get end decoration null value arrow tip end return new integer value return super get attribute name
|
gets the attribute with the given name
|
public void set attribute string name object value if name equals frame color set frame color color value changed else if name equals arrow mode integer int obj integer value if int obj null int decoration int obj int value if decoration arrow tip start 0 set start decoration new arrow tip else set start decoration null if decoration arrow tip end 0 set end decoration new arrow tip else set end decoration null changed else super set attribute name value
|
sets the attribute with the given name
|
public object get attribute string name font font get font if name equals font size return new integer font get size if name equals font style return new integer font get style if name equals font name return font get name return super get attribute name
|
a text figure understands the font size font style and font name
|
public object get string name return f map get name
|
gets the attribute with the given name
|
protected void prepare text if is text dirty return f paragraphs new array list string paragraph text point pos new point 1 1 while paragraph text get next paragraph f text pos null if paragraph text length 0 paragraph text f paragraphs add paragraph text set text dirty false
|
splits the text into paragraphs
|
public void set string name object value if value null f map put name value else f map remove name
|
sets the attribute with the given name and
|
public boolean has defined string name return f map contains key name
|
tests if an attribute is defined
|
public object clone try figure attributes a figure attributes super clone a f map hashtable f map clone return a catch clone not supported exception e throw new internal error
|
clones the attributes
|
protected undoable create undo activity return new text tool undo activity view get typing target get text
|
factory method for undo activity
|
public void set text string new text if new text equals f text will change f text new string new text mark dirty changed
|
sets the text shown by the text figure
|
public void start point int x int y will change if f points size 0 f points add element new point x y else f points set element at new point x y 0 changed
|
sets the start point
|
public void end point int x int y will change if f points size 2 f points add element new point x y else f points set element at new point x y f points size 1 changed
|
sets the end point
|
protected void paint component graphics g get display update draw g this
|
paints the drawing view
|
public point start point point p point f points first element return new point p x p y
|
gets the start point
|
public object get attribute string name if f attributes null if f attributes has defined name return f attributes get name return get default attribute name
|
returns the named attribute or null if a
|
public void set attribute string name object value if f attributes null f attributes new figure attributes f attributes set name value changed
|
sets the named attribute to the new value
|
public point end point point p point f points last element return new point p x p y
|
gets the end point
|
public void write storable output dw super write dw if f attributes null dw write string no attributes else dw write string attributes f attributes write dw
|
stores the figure to a storable output
|
public vector handles vector handles new vector f points size handles add element new change connection start handle this for int i 1 i f points size 1 i handles add element new poly line handle this locator i i handles add element new change connection end handle this return handles
|
gets the handles of the figure
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.