@Override public void ancestorResized(HierarchyEvent e) { // if one of the parents is viewport, resized events will not be propagated down unless viewport is changing visibility of scrollbars. // To make sure Label is able to re-wrap text when viewport size changes, initiate re-wrapping here by changing size of view if (e.getChanged() instanceof JViewport) { Rectangle viewportBounds = e.getChanged().getBounds(); if (viewportBounds.getWidth() < getWidth()) { View view = getWrappingView(); if (view != null) { view.setSize(viewportBounds.width, viewportBounds.height); } } } }}); }
super.paintComponent(g); } else { pWidth = getWidth(); pHeight = getHeight(); if (backgroundPainter != null) { pWidth = getWidth() - i.left - i.right; pHeight = getHeight() - i.top - i.bottom; double wx = Math.sin(textRotation) * tPoint.getY() + Math.cos(textRotation) * tPoint.getX(); double wy = Math.sin(textRotation) * tPoint.getX() + Math.cos(textRotation) * tPoint.getY(); double x = (getWidth() - wx) / 2 + Math.sin(textRotation) * tPoint.getY(); double y = (getHeight() - wy) / 2; Graphics2D tmp = (Graphics2D) g.create();
public void ancestorResized(HierarchyEvent e) { // if one of the parents is viewport, resized events will not be propagated down unless viewport is changing visibility of scrollbars. // To make sure Label is able to re-wrap text when viewport size changes, initiate re-wrapping here by changing size of view if (e.getChanged() instanceof JViewport) { Rectangle viewportBounds = e.getChanged().getBounds(); if (viewportBounds.getWidth() < getWidth()) { View view = getWrappingView(); if (view != null) { view.setSize(viewportBounds.width, viewportBounds.height); } } } }}); }
super.paintComponent(g); } else { pWidth = getWidth(); pHeight = getHeight(); Insets i = getInsets(); pWidth = getWidth() - i.left - i.right; pHeight = getHeight() - i.top - i.bottom; double wx = Math.sin(textRotation) * tPoint.getY() + Math.cos(textRotation) * tPoint.getX(); double wy = Math.sin(textRotation) * tPoint.getX() + Math.cos(textRotation) * tPoint.getY(); double x = (getWidth() - wx) / 2 + Math.sin(textRotation) * tPoint.getY(); double y = (getHeight() - wy) / 2; Graphics2D tmp = (Graphics2D) g.create();
super.paintComponent(g); } else { pWidth = getWidth(); pHeight = getHeight(); if (backgroundPainter != null) { pWidth = getWidth() - i.left - i.right; pHeight = getHeight() - i.top - i.bottom; double wx = Math.sin(textRotation) * tPoint.getY() + Math.cos(textRotation) * tPoint.getX(); double wy = Math.sin(textRotation) * tPoint.getX() + Math.cos(textRotation) * tPoint.getY(); double x = (getWidth() - wx) / 2 + Math.sin(textRotation) * tPoint.getY(); double y = (getHeight() - wy) / 2; Graphics2D tmp = (Graphics2D) g.create();
@Override public void ancestorResized(HierarchyEvent e) { // if one of the parents is viewport, resized events will not be propagated down unless viewport is changing visibility of scrollbars. // To make sure Label is able to re-wrap text when viewport size changes, initiate re-wrapping here by changing size of view if (e.getChanged() instanceof JViewport) { Rectangle viewportBounds = e.getChanged().getBounds(); if (viewportBounds.getWidth() < getWidth()) { View view = getWrappingView(); if (view != null) { view.setSize(viewportBounds.width, viewportBounds.height); } } } }}); }
super.paintComponent(g); } else { pWidth = getWidth(); pHeight = getHeight(); if (backgroundPainter != null) { pWidth = getWidth() - i.left - i.right; pHeight = getHeight() - i.top - i.bottom; double wx = Math.sin(textRotation) * tPoint.getY() + Math.cos(textRotation) * tPoint.getX(); double wy = Math.sin(textRotation) * tPoint.getX() + Math.cos(textRotation) * tPoint.getY(); double x = (getWidth() - wx) / 2 + Math.sin(textRotation) * tPoint.getY(); double y = (getHeight() - wy) / 2; Graphics2D tmp = (Graphics2D) g.create();
super.paintComponent(g); } else { pWidth = getWidth(); pHeight = getHeight(); if (backgroundPainter != null) { pWidth = getWidth() - i.left - i.right; pHeight = getHeight() - i.top - i.bottom; double wx = Math.sin(textRotation) * tPoint.getY() + Math.cos(textRotation) * tPoint.getX(); double wy = Math.sin(textRotation) * tPoint.getX() + Math.cos(textRotation) * tPoint.getY(); double x = (getWidth() - wx) / 2 + Math.sin(textRotation) * tPoint.getY(); double y = (getHeight() - wy) / 2; Graphics2D tmp = (Graphics2D) g.create();
@Override public void ancestorResized(HierarchyEvent e) { // if one of the parents is viewport, resized events will not be propagated down unless viewport is changing visibility of scrollbars. // To make sure Label is able to re-wrap text when viewport size changes, initiate re-wrapping here by changing size of view if (e.getChanged() instanceof JViewport) { Rectangle viewportBounds = e.getChanged().getBounds(); if (viewportBounds.getWidth() < getWidth()) { View view = getWrappingView(); if (view != null) { view.setSize(viewportBounds.width, viewportBounds.height); } } } }}); }
@Override public void ancestorResized(HierarchyEvent e) { // if one of the parents is viewport, resized events will not be propagated down unless viewport is changing visibility of scrollbars. // To make sure Label is able to re-wrap text when viewport size changes, initiate re-wrapping here by changing size of view if (e.getChanged() instanceof JViewport) { Rectangle viewportBounds = e.getChanged().getBounds(); if (viewportBounds.getWidth() < getWidth()) { View view = getWrappingView(); if (view != null) { view.setSize(viewportBounds.width, viewportBounds.height); } } } }}); }
private Point2D calculateT() { double tx = getWidth(); double ty = getHeight(); pWidth = getWidth(); } else { double square = Math.min(getHeight(), getWidth()) * Math.cos(Math.PI / 4d); double cw = (getWidth() - Math.abs(ty * Math.sin(textRotation))) / Math.abs(Math.cos(textRotation)); double ch = (getHeight() - Math.abs(ty * Math.cos(textRotation))) double cw = (getWidth() - Math.abs(h * Math.sin(alpha))) / Math.abs(Math.cos(alpha)); double ch = (getHeight() - Math.abs(h * Math.cos(alpha))) / Math.abs(Math.sin(alpha));
private Point2D calculateT() { double tx = getWidth(); double ty = getHeight(); pWidth = getWidth(); } else { double square = Math.min(getHeight(), getWidth()) * Math.cos(Math.PI / 4d); double cw = (getWidth() - Math.abs(ty * Math.sin(textRotation))) / Math.abs(Math.cos(textRotation)); double ch = (getHeight() - Math.abs(ty * Math.cos(textRotation))) double cw = (getWidth() - Math.abs(h * Math.sin(alpha))) / Math.abs(Math.cos(alpha)); double ch = (getHeight() - Math.abs(h * Math.cos(alpha))) / Math.abs(Math.sin(alpha));
private Point2D calculateT() { double tx = getWidth(); double ty = getHeight(); pWidth = getWidth(); } else { double square = Math.min(getHeight(), getWidth()) * Math.cos(Math.PI / 4d); double cw = (getWidth() - Math.abs(ty * Math.sin(textRotation))) / Math.abs(Math.cos(textRotation)); double ch = (getHeight() - Math.abs(ty * Math.cos(textRotation))) double cw = (getWidth() - Math.abs(h * Math.sin(alpha))) / Math.abs(Math.cos(alpha)); double ch = (getHeight() - Math.abs(h * Math.cos(alpha))) / Math.abs(Math.sin(alpha));
private Point2D calculateT() { double tx = (double) getWidth(); double ty = (double) getHeight(); pWidth = getWidth(); } else { double square = Math.min(getHeight(), getWidth()) * Math.cos(Math.PI / 4d); double cw = (getWidth() - Math.abs(ty * Math.sin(textRotation))) / Math.abs(Math.cos(textRotation)); double ch = (getHeight() - Math.abs(ty * Math.cos(textRotation))) double cw = (getWidth() - Math.abs(h * Math.sin(alpha))) / Math.abs(Math.cos(alpha)); double ch = (getHeight() - Math.abs(h * Math.cos(alpha))) / Math.abs(Math.sin(alpha));
private Point2D calculateT() { double tx = getWidth(); double ty = getHeight(); pWidth = getWidth(); } else { double square = Math.min(getHeight(), getWidth()) * Math.cos(Math.PI / 4d); double cw = (getWidth() - Math.abs(ty * Math.sin(textRotation))) / Math.abs(Math.cos(textRotation)); double ch = (getHeight() - Math.abs(ty * Math.cos(textRotation))) double cw = (getWidth() - Math.abs(h * Math.sin(alpha))) / Math.abs(Math.cos(alpha)); double ch = (getHeight() - Math.abs(h * Math.cos(alpha))) / Math.abs(Math.sin(alpha));