use of java.awt.Dimension in project opennms by OpenNMS.
the class RealUltimateLayoutAlgorithm method updateLayout.
@Override
public void updateLayout(Graph graph) {
final Layout graphLayout = graph.getLayout();
SparseGraph<VertexRef, EdgeRef> jungGraph = new SparseGraph<VertexRef, EdgeRef>();
Collection<? extends Vertex> vertices = graph.getDisplayVertices();
for (Vertex v : vertices) {
jungGraph.addVertex(v);
}
Collection<? extends Edge> edges = graph.getDisplayEdges();
for (Edge e : edges) {
jungGraph.addEdge(e, e.getSource().getVertex(), e.getTarget().getVertex());
}
Dimension size = selectLayoutSize(graph);
Dimension paddedSize = new Dimension((int) (size.getWidth() * .75), (int) (size.getHeight() * .75));
doISOMLayout(graphLayout, jungGraph, size);
doSpringLayout(graphLayout, jungGraph, size, SPRING_LAYOUT_REPULSION);
doFRLayout(graphLayout, jungGraph, paddedSize, (int) (size.getWidth() / 8.0), (int) (size.getHeight() / 8.0));
doSpringLayout(graphLayout, jungGraph, size, SPRING_LAYOUT_REPULSION);
}
use of java.awt.Dimension in project zaproxy by zaproxy.
the class AbstractDialog method centreDialog.
/**
* Centres this dialog on the main fame.
* This is needed, because when using multiple monitors.
* Additionally, it will shrink the size of the dialog to fit the screen.
*/
public void centreDialog() {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
// shrink dialog to fit screen if necessary
frameSize.height = Math.min(frameSize.height, screenSize.height);
frameSize.width = Math.min(frameSize.width, screenSize.width);
// centres the dialog on main frame
final Rectangle mainrect = View.getSingleton().getMainFrame().getBounds();
int x = mainrect.x + (mainrect.width - frameSize.width) / 2;
int y = mainrect.y + (mainrect.height - frameSize.height) / 2;
// finally set the new location
this.setLocation(x, y);
}
use of java.awt.Dimension in project zaproxy by zaproxy.
the class FilterReplaceDialog method initialize.
/**
* This method initializes this
*/
protected void initialize() {
// ZAP: Changed visibility from private to protected.
this.setContentPane(getJPanel());
// ZAP: Added 10 more pixels to the dialog's height
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
this.setSize(346, 166);
}
this.setPreferredSize(new Dimension(346, 166));
this.pack();
}
use of java.awt.Dimension in project jdk8u_jdk by JetBrains.
the class BMPCompressionTest method showDiff.
private static void showDiff(final BufferedImage in, final BufferedImage out) {
final int width = in.getWidth();
final int height = in.getHeight();
JFrame f = new JFrame("");
f.getContentPane().add(new JComponent() {
public Dimension getPreferredSize() {
return new Dimension(2 * width + 2, height);
}
public void paintComponent(Graphics g) {
g.setColor(Color.black);
g.drawImage(in, 0, 0, null);
g.drawImage(out, width + 2, 0, null);
}
});
f.pack();
f.setVisible(true);
}
use of java.awt.Dimension in project jdk8u_jdk by JetBrains.
the class bug4337267 method createContentPane.
Component createContentPane() {
Dimension size = new Dimension(500, 100);
i1 = new TestBufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
i2 = new TestBufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
p1 = new TestJPanel();
p1.setPreferredSize(size);
p2 = new TestJPanel();
p2.setPreferredSize(size);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(p1);
panel.add(p2);
return panel;
}
Aggregations