MCPcopy Index your code
hub / github.com/adolfintel/NoteBot / setBounds

Method setBounds

StickyNotes/src/com/dosse/stickynotes/Note.java:591–606  ·  view source on GitHub ↗

setBounds method is overridden to force the note to stay on the screen @param x x @param y y @param width width @param height height

(int x, int y, int width, int height)

Source from the content-addressed store, hash-verified

589 * @param height height
590 */
591 @Override
592 public void setBounds(int x, int y, int width, int height) {
593 if (preferredLocation == null) { //for some odd fucking reason, this can happen on some versions of java
594 preferredLocation = new Point(0, 0);
595 }
596 preferredLocation.x = x;
597 preferredLocation.y = y;
598 Dimension s = Main.getExtendedScreenResolution();
599 if (x + 60 * Main.SCALE > s.width) {
600 x = (int) (s.width - 60 * Main.SCALE);
601 }
602 if (y + 60 * Main.SCALE > s.height) {
603 y = (int) (s.height - 60 * Main.SCALE);
604 }
605 super.setBounds(x, y, width, height);
606 }
607
608 /**
609 * setBounds method is overridden to force the note to stay on the screen

Callers 3

setLocationMethod · 0.95
AboutDialogMethod · 0.80
changeBoundsMethod · 0.80

Calls 1

Tested by

no test coverage detected