List of usage examples for java.lang Boolean TRUE
Boolean TRUE
To view the source code for java.lang Boolean TRUE.
Click Source Link
From source file:Main.java
public static void main(String[] args) { Vector<Double> doubleVector = new Vector<Double>(); Vector<Integer> integerVector = new Vector<Integer>(); Vector<Boolean> booleanVector = new Vector<Boolean>(); Vector<Icon> iconVector = new Vector<Icon>(); Icon icon1 = ((UIManager.getIcon("OptionPane.errorIcon"))); Icon icon2 = (UIManager.getIcon("OptionPane.informationIcon")); Icon icon3 = (UIManager.getIcon("OptionPane.warningIcon")); Icon icon4 = (UIManager.getIcon("OptionPane.questionIcon")); doubleVector.addElement(1.001);// w ww .ja v a 2 s . co m doubleVector.addElement(10.00); doubleVector.addElement(0.95); doubleVector.addElement(4.2); JComboBox comboBoxDouble = new JComboBox(doubleVector); integerVector.addElement(1); integerVector.addElement(2); integerVector.addElement(3); integerVector.addElement(4); JComboBox comboBoxInteger = new JComboBox(integerVector); booleanVector.add(Boolean.TRUE); booleanVector.add(Boolean.FALSE); JComboBox comboBoxBoolean = new JComboBox(booleanVector); iconVector.addElement(icon1); iconVector.addElement(icon2); iconVector.addElement(icon3); iconVector.addElement(icon4); JComboBox comboBoxIcon = new JComboBox(iconVector); JFrame frame = new JFrame(); frame.setLayout(new GridLayout(2, 2, 5, 5)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(comboBoxDouble); frame.add(comboBoxInteger); frame.add(comboBoxBoolean); frame.add(comboBoxIcon); frame.pack(); frame.setVisible(true); }
From source file:com.cloudhopper.sxmp.SubmitMain.java
static public void main(String[] args) throws Exception { String url = "http://localhost:9080/api/sxmp/1.0"; // create a submit request SubmitRequest submit = new SubmitRequest(); submit.setAccount(new Account("customer1", "password1")); submit.setDeliveryReport(Boolean.TRUE); MobileAddress sourceAddr = new MobileAddress(); sourceAddr.setAddress(MobileAddress.Type.NETWORK, "40404"); submit.setSourceAddress(sourceAddr); submit.setOperatorId(24);/* w w w. jav a 2 s . c om*/ MobileAddress destAddr = new MobileAddress(); destAddr.setAddress(MobileAddress.Type.INTERNATIONAL, "+14155551212"); submit.setDestinationAddress(destAddr); submit.setText( "Test abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijjabcdefghijjabcdefghijjabcdefghijjabcdefghijjabcdefghijjabcdefghijjabcdefghijbcdefghij", TextEncoding.UTF_8); //submit.setText("Hello World"); // Get file to be posted HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); client.getParams().setParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, Boolean.FALSE); long totalStart = System.currentTimeMillis(); int count = 1; for (int i = 0; i < count; i++) { long start = System.currentTimeMillis(); // execute request try { HttpPost post = new HttpPost(url); //ByteArrayEntity entity = new ByteArrayEntity(data); StringEntity entity = new StringEntity(SxmpWriter.createString(submit)); entity.setContentType("text/xml; charset=\"iso-8859-1\""); post.setEntity(entity); ResponseHandler<String> responseHandler = new BasicResponseHandler(); String responseBody = client.execute(post, responseHandler); long stop = System.currentTimeMillis(); logger.debug("----------------------------------------"); logger.debug("Response took " + (stop - start) + " ms"); logger.debug(responseBody); logger.debug("----------------------------------------"); } finally { // do nothing } } long totalEnd = System.currentTimeMillis(); logger.debug("Response took " + (totalEnd - totalStart) + " ms for " + count + " requests"); double seconds = ((double) (totalEnd - totalStart)) / 1000; double smspersec = ((double) count) / seconds; logger.debug("SMS / Sec: " + DecimalUtil.toString(smspersec, 2)); }
From source file:DesktopSample.java
public static void main(String[] args) { String title = "Desktop Sample"; JFrame frame = new JFrame(title); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JDesktopPane desktop = new JDesktopPane(); JInternalFrame internalFrames[] = { new JInternalFrame("Can Do All", true, true, true, true), new JInternalFrame("Not Resizable", false, true, true, true), new JInternalFrame("Not Closable", true, false, true, true), new JInternalFrame("Not Maximizable", true, true, false, true), new JInternalFrame("Not Iconifiable", true, true, true, false) }; InternalFrameListener internalFrameListener = new InternalFrameIconifyListener(); for (int i = 0, n = internalFrames.length; i < n; i++) { desktop.add(internalFrames[i]);/* w w w. j a v a2 s. c o m*/ internalFrames[i].setBounds(i * 25, i * 25, 200, 100); internalFrames[i].addInternalFrameListener(internalFrameListener); JLabel label = new JLabel(internalFrames[i].getTitle(), JLabel.CENTER); Container content = internalFrames[i].getContentPane(); content.add(label, BorderLayout.CENTER); internalFrames[i].setVisible(true); } JInternalFrame palette = new JInternalFrame("Palette", true, false, true, false); palette.setBounds(350, 150, 100, 100); palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); desktop.add(palette, JDesktopPane.PALETTE_LAYER); palette.setVisible(true); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); Container content = frame.getContentPane(); content.add(desktop, BorderLayout.CENTER); frame.setSize(500, 300); frame.setVisible(true); }
From source file:SwingToolBarSample.java
public static void main(String args[]) { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { System.out.println(actionEvent.getActionCommand()); }//from w w w.j a va 2s . c om }; JFrame frame = new JFrame("JToolBar Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JToolBar toolbar = new JToolBar(); toolbar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); for (int i = 0, n = buttonColors.length; i < n; i++) { Object color[] = buttonColors[i]; if (color == null) { toolbar.addSeparator(); } else { Icon icon = new DiamondIcon((Color) color[COLOR_POSITION], true, 20, 20); JButton button = new JButton(icon); button.setActionCommand((String) color[STRING_POSITION]); button.addActionListener(actionListener); toolbar.add(button); } } Action action = new ActionMenuSample.ShowAction(frame); toolbar.add(action); Container contentPane = frame.getContentPane(); contentPane.add(toolbar, BorderLayout.NORTH); JTextArea textArea = new JTextArea(); JScrollPane pane = new JScrollPane(textArea); contentPane.add(pane, BorderLayout.CENTER); frame.setSize(350, 150); frame.setVisible(true); }
From source file:org.lieuofs.extraction.etatpays.ExtractionEtat.java
/** * @param args/*from www . j a v a2 s.co m*/ */ public static void main(String[] args) throws IOException { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "beans_lieuofs.xml" }); EtatTerritoireCritere critere = new EtatTerritoireCritere(); critere.setEstEtat(Boolean.TRUE); // critere.setValide(Boolean.TRUE); EtatTerritoireDao dao = (EtatTerritoireDao) context.getBean("etatTerritoireDao"); Set<EtatTerritoirePersistant> etats = dao.rechercher(critere); EtatWriter etatWriter = new CsvPlatEtatWriter(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream("Etat.txt"), "UTF-8")); List<EtatTerritoirePersistant> listeTriee = new ArrayList<EtatTerritoirePersistant>(etats); Collections.sort(listeTriee, new Comparator<EtatTerritoirePersistant>() { @Override public int compare(EtatTerritoirePersistant o1, EtatTerritoirePersistant o2) { //return o1.getFormeCourte("fr").compareTo(o2.getFormeCourte("fr")); return o1.getNumeroOFS() - o2.getNumeroOFS(); } }); for (EtatTerritoirePersistant etat : listeTriee) { String etatStr = etatWriter.ecrireEtat(etat); if (null != etatStr) { writer.append(etatStr); } } writer.close(); }
From source file:com.cloudhopper.sxmp.demo.SubmitMain.java
static public void main(String[] args) throws Exception { String url = "http://127.0.0.1:8080/api/sxmp/1.0"; String phone = "+14155551212"; int operator = 1; if (args.length > 0) url = args[0];/* w w w .ja v a 2 s .co m*/ if (args.length > 1) phone = args[1]; if (args.length > 2) operator = Integer.parseInt(args[2]); // create a submit request SubmitRequest submit = new SubmitRequest(); submit.setAccount(new Account("customer1", "password1")); submit.setDeliveryReport(Boolean.TRUE); MobileAddress sourceAddr = new MobileAddress(); sourceAddr.setAddress(MobileAddress.Type.NETWORK, "40404"); submit.setSourceAddress(sourceAddr); submit.setOperatorId(operator); submit.setPriority(Priority.URGENT); MobileAddress destAddr = new MobileAddress(); destAddr.setAddress(MobileAddress.Type.INTERNATIONAL, phone); submit.setDestinationAddress(destAddr); submit.setText("Hello World"); // Get file to be posted HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); client.getParams().setParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, Boolean.FALSE); long totalStart = System.currentTimeMillis(); int count = 1; for (int i = 0; i < count; i++) { long start = System.currentTimeMillis(); // execute request try { HttpPost post = new HttpPost(url); //ByteArrayEntity entity = new ByteArrayEntity(data); StringEntity entity = new StringEntity(SxmpWriter.createString(submit)); entity.setContentType("text/xml; charset=\"iso-8859-1\""); post.setEntity(entity); ResponseHandler<String> responseHandler = new BasicResponseHandler(); String responseBody = client.execute(post, responseHandler); long stop = System.currentTimeMillis(); logger.debug("----------------------------------------"); logger.debug("Response took " + (stop - start) + " ms"); logger.debug(responseBody); logger.debug("----------------------------------------"); } finally { // do nothing } } long totalEnd = System.currentTimeMillis(); logger.debug("Response took " + (totalEnd - totalStart) + " ms for " + count + " requests"); double seconds = ((double) (totalEnd - totalStart)) / 1000; double smspersec = ((double) count) / seconds; logger.debug("SMS / Sec: " + DecimalUtil.toString(smspersec, 2)); }
From source file:com.turbospaces.api.EmbeddedJSpaceRunner.java
/** * launcher method//from w ww . j a v a 2s. c om * * @param args * [1 argument = application context path] * @throws Exception * re-throw execution errors if any */ public static void main(final String... args) throws Exception { JVMUtil.gcOnExit(); String appContextPath = args[0]; if (System.getProperty(Global.IPv4) == null && System.getProperty(Global.IPv6) == null) System.setProperty(Global.IPv4, Boolean.TRUE.toString()); System.setProperty(Global.CUSTOM_LOG_FACTORY, JGroupsCustomLoggerFactory.class.getName()); LOGGER.info("Welcome to turbospaces:version = {}, build date = {}", SpaceUtility.projectVersion(), SpaceUtility.projecBuildTimestamp()); LOGGER.info("{}: launching configuration {}", EmbeddedJSpaceRunner.class.getSimpleName(), appContextPath); AbstractXmlApplicationContext c = appContextPath.startsWith("file") ? new FileSystemXmlApplicationContext(appContextPath) : new ClassPathXmlApplicationContext(appContextPath); c.getBeansOfType(JSpace.class); c.registerShutdownHook(); Collection<SpaceConfiguration> configurations = c.getBeansOfType(SpaceConfiguration.class).values(); for (SpaceConfiguration spaceConfiguration : configurations) spaceConfiguration.joinNetwork(); LOGGER.info("all jspaces joined network, notifying waiting threads..."); synchronized (joinNetworkMonitor) { joinNetworkMonitor.notifyAll(); } while (!Thread.currentThread().isInterrupted()) synchronized (c) { try { c.wait(TimeUnit.SECONDS.toMillis(1)); } catch (InterruptedException e) { LOGGER.info("got interruption signal, terminating jspaces... stack_trace = {}", Throwables.getStackTraceAsString(e)); Thread.currentThread().interrupt(); Util.printThreads(); } } c.destroy(); }
From source file:Main.java
public static void main(String[] args) throws JAXBException { HumansList list = new HumansList(); Person parent1 = new Person("parent1"); list.addHuman(parent1);//from www. j a v a2 s. co m Person child11 = new Person("child11"); list.addHuman(child11); Person child12 = new Person("child12"); list.addHuman(child12); Person parent2 = new Person("parent2"); list.addHuman(parent2); Person child21 = new Person("child21"); list.addHuman(child21); Person child22 = new Person("child22"); list.addHuman(child22); JAXBContext context = JAXBContext.newInstance(HumansList.class); Marshaller m = context.createMarshaller(); StringWriter xml = new StringWriter(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); m.marshal(list, xml); System.out.println(xml); }
From source file:com.yufei.dataget.dataretriver.HttpDataRetriverUsingFirefoxDriverWithTimeOut.java
public static void main(String[] args) throws MalformedURLException { DataRetrieverFeatures dataRetrieverFeatures = new DataRetrieverFeatures(Boolean.TRUE, null, 10L * 1000, 3 * 1000);/* www. j a v a 2 s .c o m*/ HttpDataRetriverUsingFirefoxDriverWithTimeOut hdrufdwto = new HttpDataRetriverUsingFirefoxDriverWithTimeOut( dataRetrieverFeatures); String url = "http://www.baidu.com/tools?url=http%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DO0urTq_fyCkG3Rd2veZDQm7TLJ50XyUOeeoybddPUG6zBjpgh37XHtMM_oXKe4nQxM-q5IEVjldslw0tbkMfvK&jump=http%3A%2F%2Fkoubei.baidu.com%2Fwomc%2Fp%2Fsentry%3Ftitle%3D%012014%01-%012015%01%E5%B9%B4%E5%BA%A6%01QS%01%E4%B8%96%E7%95%8C%01%E6%8E%92%E5%90%8D%01%3A%01%E6%BE%B3%E5%A4%A7%E5%88%A9%E4%BA%9A%01%E5%A4%A7%E5%AD%A6%0123%01%E6%89%80%01%E9%AB%98%E6%A0%A1%01%E8%BF%9B%E5%85%A5%02TOP%01500%03-%01%E7%95%99%E5%AD%A6%01-%01...%26q%3Dtop%20500%20university&key=surl"; hdrufdwto.setUrl(new URL(url)); hdrufdwto.connect(); System.out.print(hdrufdwto.getHtmlContent()); hdrufdwto.disconnect(); }
From source file:com.wormsim.LaunchFromCodeMain.java
public static void main(String[] args) throws IOException { // TODO: Move this from utils into SimulationCommands itself. SimulationCommands cmds = Utils.readCommandLine(args); SimulationOptions ops = new SimulationOptions(cmds); // Change options here. ops.checkpoint_no.set(CHECKPOINT_NUMBER); ops.thread_no.set(3);//from w ww . j a v a 2 s .c om ops.assay_iteration_no.set(100); ops.burn_in_no.set(20000); ops.record_no.set(40000); ops.detailed_data.set(Boolean.TRUE); ops.walker_no.set(32); ops.pheromone_no.set(1); ops.forced_run.set(Boolean.TRUE); ops.initial_conditions.set(makeCustomInitialConditions()); ops.animal_zoo.set(makeCustomAnimalZoo(ops)); // TODO: Add in the options for additional tracked values. if (ops.isMissingParameters()) { String msg = "Missing Parameters: " + ops.getMissingParametersList(); LOG.log(Level.SEVERE, msg); System.exit(-1); } else { new Simulation(ops, new TrackedCalculation("Fitness", ops) { @Override protected double added(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value + (p_group.getAnimalStage().toString().contains("Dauer") ? p_group.getCount() : 0.0); } @Override protected double end(SimulationThread.SamplingInterface p_iface, double p_prev_value) { return Math.pow(p_prev_value, 2); } @Override protected double ended(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value; } @Override protected double initialise(RandomGenerator p_rng) { return 0.0; } @Override protected double removed(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value; } }, new TrackedCalculation[] { new TrackedCalculation("Dauers", ops) { @Override protected double added(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value + (p_group.getAnimalStage().toString().contains("Dauer") ? p_group.getCount() : 0.0); } @Override protected double end(SimulationThread.SamplingInterface p_iface, double p_prev_value) { return p_prev_value; } @Override protected double ended(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value; } @Override protected double initialise(RandomGenerator p_rng) { return 0.0; } @Override protected double removed(SimulationThread.SamplingInterface p_iface, AnimalGroup p_group, double p_prev_value) { return p_prev_value; } } }).run(); } }