15,499,967 members

so this is the code block that creates the shape for the maximum sets. and I want to copy this block and revise it a little bit so that the minimum sets can be shown.

public class DC extends JComponent { public Shapes sp; protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); sp = new Shapes(); int x = 59; int y = 100; for (int e = 0; e < allNodes.size(); e++) { if (e < 5) { sp = new Shapes(); if (waypus.equals("#")) { boolean tf = false; //i will just make this true to make it minumum for (int w = 0; w < waypusL.get(ux).size(); w++) { if (sp.oDXof(waypusL.get(ux).get(w)) == e) { tf = true; //i will just make this false to make it minimum } } if (tf == true) { sp.drawCircle(g2d, x, y, "go"); } else { sp.drawCircle(g2d, x, y, "stop"); } x = x + 175; continue; } sp.drawCircle(g2d, x, y, "stop"); x = x + 175; } else if (e >= 5) { if (e == 5) { x = 59; y = 375; } sp = new Shapes(); sp.drawCircle(g2d, x, y, ""); x = x + 175; } if (e == allNodes.size() - 1) { waypus = "b2wp"; } } for (int k = 0; k < allNodes.size(); k++) { sp.drawLine(g2d, greenCenter[k][0], greenCenter[k][1], allNodes.get(k)); g2d.setColor(new Color(139, 0, 0, 255)); g2d.drawString(allNodes.get(k).name, greenCenter[k][0] - 33, greenCenter[k][1] + 15); } g2d.setColor(new Color(0, 0, 0, 255)); g2d.drawString("Number of Nodes = " + allNodes.size(), 59, 540); g2d.drawString("Number of Edges = " + (connections.size() / 2), 59, 560); } }

this is the created jframe this only shows one graph, which is the maximum set

public class DT { public void root() { int x = 893; int y = 643; DC dc = new DC(); jframe.setSize(x, y); jframe.setTitle("Drawing of the Graph"); jframe.add(dc); jframe.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); / jframe.setVisible(true); jframe.setResizable(false); jframe.setAlwaysOnTop(true); jframe.addKeyListener(new fromKB()); jframe.setState(Frame.ICONIFIED); jframe.setState(Frame.NORMAL); } }

So its basically adding 2 results in one jframe

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900