Swing/AWT/SWT :: Not Able To See Network Activity In JFrame
Jun 1, 2014
I am trying to develop an application which will be showing a TimeSeries graph(related library JFreeChart) displaying network activity related to a particular network interface embedded in a JFrame.I have created a JPopUpMenu which is having containing a list of JMenuItems showing network interfaces as their String values.Menu is popping up correctly
Further I am selecting a JMenuItem related to a particular network interface to show network activity in TimeSeries graph.On selecting a JMenuItem I can see that graph is moving on constantly but not able to see any network activity.
Pasted the code below :
package com.ankit.analyser;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Window;
import javax.swing.JFrame;
[Code] .....
Further I can see that packetArrived method of PacketListener is not being overridden by class PacketHandler as I am not able to see data packets on console and static list in main class is also empty.
View Replies
ADVERTISEMENT
Sep 21, 2014
I have a program that records and reruns network traffic. It was developed in C and runs in my case under Windows 7 Professional but will run almost anywhere. I have observed a lack of stability.
First I have a JAVA stand alone GUI program that runs the program as follows:
g11_bttn_start_script_capture.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
URI uri = null;
URL url = null;
String tempstr = "";
tempstr = "-s " + g11_txt_PATH_portnumber.getText() + " " + g11_txt_scriptname.getText() + ".both";
[Code] ....
Basically it launches the executable t3drive, hangs arounf so it gets a chance to start, and then connect to it via the embedded browser.
It frequently works, sometimes launches in the browser but then freezes, and sometimes fails to start at all.
t3drive works 100% of the time if I run it under cygwin and I can reliably connect to it using any browser.
Why this might not be stable? Just looking for a direction of what to try next.
View Replies
View Related
Feb 8, 2015
I didn't see anything specific to Android. I am a very basic beginner when it comes to JAVA and Android programming.
The app is a very simple comic strip viewer that views 3 panels of a comic strip one at a time. My problem is going from a second activity to another. I can go from the main activity to the second fine but when I press the next button to go from the second activity to the third nothing happens. I have tried a few different things but end up with either nothing happening or the app crashes.
Here is my MainActivity Code:
package net.androidbootcamp.comicapp;
import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
[Code]...
Here is the code for the second panel:
package net.androidbootcamp.comicapp;
import android.app.Activity;
import android.os.Bundle;
public class Panel2 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
[Code]...
Here is the code for Panel 3:
package net.androidbootcamp.comicapp;
import android.app.Activity;
import android.os.Bundle;
public class Panel3 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
[Code]...
And here is the manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="[URL].."
package="net.androidbootcamp.comicapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
[Code]...
I am sure it is something very simple but I am not sure what it could be.
View Replies
View Related
Dec 5, 2014
I'm working on my Android project where I created Expandablelistview with men's and women's sports. Now I have to populate each sport with my text data which contains events. I'm stack at this point, already tried few thing but that did not work. Here is my data how it looks like:
this Main (id=831962574768)
groupedFeeds ArrayList (id=831963150464)
array Object[12] (id=831963153088)
[0] GroupedFeed (id=831963152968)
category "Women's Golf" (id=831962986192)
feeds ArrayList (id=831963152992)
[1] GroupedFeed (id=831963153592)
[Code]...
I have here my Main method where I have to pass data to each of my sports(activities). I tried to create a for loop and then pass result to my sport(activity) but I'm doing something wrong and can not get that work. Here is my code:
GroupedFeed findFeed(String locateSport){ //here I tried to create a loop which gonna search for certain sport in array list
//and then pass it to gfResult. }
public boolean onChildClick(ExpandableListView parent,
android.view.View v, int groupPosition, int childPosition,
long id) {
switch (groupPosition)
[Code]...
View Replies
View Related
Feb 23, 2014
I need to write up a code that will print the lyrics of the Green Bottles song. So it will ask the user to input a number and it will use that number to print the lyrics and then count down from that number. For example, user enters the number 5, the program will run and display:
"5 green bottles, hanging on the wall
5 green bottles hanging on the wall
and if one green bottles should fall
there will be 4 green bottles hanging on the wall
4 green bottles, hanging on the wall...." and so on.
So far I have managed to write a code that will display the number that is entered but I cant figure out how to subtract the number by 1 to continue it. My code so far:
import java.util.Scanner;
public class SomeJavaCode
{
public static void main(String[] args)
{
System.out.println("How many bottles to start with?");
[Code] ....
How to code it so that it substracts the number and repeats the rhyme till 0.
View Replies
View Related
Apr 13, 2014
Is there a way to simply slap a rectangle into a JPanel (make it appear) with out creating an inner Class or helper Method, all within "Main"? And if not, why?
Making a JFrame is easy.
Adding a JPanel is a snap.
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class TheJFrame {
public static void main(String[] args) {
// TODO Auto-generated method stub
[code]....
View Replies
View Related
Apr 9, 2014
I have a Jframe and i want to add inside 4 different jpanel.This is easy.
what is difficult is how can i change them dynamically with 4 other new jpanels and 4 other new jpanels?
I have try with BorderLayout but not working.
It's a wizard like but not the same.
I have a jpanel with jbuttons jpanel with a jtable jpanel with textarea and jpanel with jlabels. All this have to change with other 4 jpanels, where to look?
View Replies
View Related
Mar 20, 2014
All I need to do is show in just one JFrame the two combined JFrames. One JFrame namely leftPanel will appear to the left or west and the other namely rightPanel to the right or east using BorderLayout. I already did creating them first as JPanels or as internal classes and subsetted them in one JFrame but that didn't work because it looked messy. And now I've created them as two separate JFrames, compiled separately, and tried to subset them as one in the JFrame. I didn't add any functionality to this program because all I intend to do is to show those two JFrames together in one JFrame. Here's the code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class dirtyIceCream extends JFrame {
leftPanel westPanel;
rightPanel eastPanel;
public dirtyIceCream()
[code].....
What am I missing or did I code anything wrong here? Or should I use NetBeans IDE for anything as complicated as this?
View Replies
View Related
Jul 23, 2014
How to load an image to a swing application?? I want to load it to myframe(JFrame)..
View Replies
View Related
May 26, 2014
I am rather new to Swing, and I am building a game right now in which I need to display a pop-up window as a reminder for what commands exist within the game. I created a class extending JFrame for this and added all the information I need. However, for some reason, no matter how many different ways I try to set the size of this window (setSize(w, h), pack(), using a different layout, adding the compnents to a JPanel first and setting the preffered size of that, then adding the JPanel to the JFrame), it doesn't work. Instead of a window of my requested size, I get a tiny, maybe 100 x 100 pixel window that needs to be resized in order for its contents to be visible.
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
[code]....
View Replies
View Related
Apr 4, 2014
I pick this code from Head first Java
package GUI;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Graphics;
import java.awt.Color;
public class gui5 {
int x=0;
int y=0;
public static void main(String... x) {
[code]...
but just a Jframe is appearing no Jpanel no green color circle?What is wrong with code
View Replies
View Related
Jan 14, 2015
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
[Code].....
View Replies
View Related
Sep 14, 2014
Following is the code on the click of a button, id like to know how do i close the current jframe on which the jButton4 is currently placed. I know how to send it to the next Jframe i.e JobCard. But need to close the current one. I tried using this.setVisible(true); But it does not work.
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.setVisible(false);
JobCard jobCard = new JobCard();
jobCard.setVisible(true);
}
View Replies
View Related
Apr 16, 2014
I need to put a Web Page in my JFrame application , I got a lot codes on the internet and could implement without problems , but the problem is that this code has an ugly page as hell, with colored all wrong and with a very poor quality , one of code I used was this :
* import javax.swing . ;
{ public class SwingWebPage
public static void main ( String args [ ] ) throws Exception {
JEditorPane website = new JEditorPane ( " http://www.google.com/ " ) ;
website.setEditable ( false) ;
[code]...
If you test , you'll see that the page is displayed in the JFrame is horrible.
View Replies
View Related
Mar 27, 2014
I am try to do an application based in multiples JFrames, each one with its particular responsibilities, and use one JPanel as a menu with buttons that connect one JFrame to another, But this menu is instantiated at run in view (layout made by netbeans) the Main Jframe appears with its internal JPanel, but the instantiated JPanel does not appear or does not show it's buttons. (notice only run method in the second class):
JPanel Menu that will be used in all alone JFrames of application:
public class MenuSuperior extends javax.swing.JPanel {
public MenuSuperior() {
initComponents();
} private void initComponents() {
[Code] .....
View Replies
View Related
Feb 7, 2014
I want my jrame should not be resized when clicking on maximize button of window.and for this i have put setResizable(false)in the constructor of class which extends Jframe.
View Replies
View Related
Apr 28, 2015
I want to know know to copy a rectangle on my jframe and paste it in another location on the same jframe.
View Replies
View Related
Sep 24, 2014
I didn't know about right method for correct close operation for JFrame component or kill the object. I found out few, which of them you are using usually???
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(false);
JFrame.DO_NOTHING_ON_CLOSE.
System.exit(0);
View Replies
View Related
Aug 30, 2014
This is right from a book I'm reading but it doesn't work. The problem is to write an application that lets you determine the integer value returned by the InputEvent method getModifiers() when you click your left, right, or middle mouse button on a JFrame.
This is the code copied directly from the book. What is missing:
import java.awt.event.InputEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JFrame;
public class JLeftOrRight {
[Code] ......
View Replies
View Related
Apr 4, 2014
I trying to replace original (and empty) JPanel in JFrame with my own made one, components does no appear right, when I pass the mouse first button appears:
MainViewClass:
...
private void initComponents() {
...
MenujPanel = new MenuSuperior();
MenujPanel.setBorder(
BorderFactory.createTitledBorder("Dados Pessoais"));
[Code] .....
Here is the video:
View Replies
View Related
Jul 2, 2014
I am trying to write a game which needs timer beginning from zero to.... , and show it in my jframe. How can I do that?
View Replies
View Related
Jan 16, 2014
How to display an image on a JFrame. If you can, pany example code.
View Replies
View Related
Apr 18, 2014
The program loads, but nothing shows. I did some research and saw that I needed to set the JFrame to visible at the bottom of the frame section. I made the change, but it still does not show anything. Do I need to add everything that I added to the content pane to the frame? From my understanding you add elements to the panel, the panel to the contentPane, then the pane to the frame...
/*
* Filename: UserInformation.java
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
@SuppressWarnings("serial")
[code]...
View Replies
View Related
Apr 13, 2014
I have a simple application where I display a JFrame. I want to maximize the JFrame size, so I have the code this.setExtendedState(MAXIMIZED_BOTH); in the constructor. How do I find the dimensions of this JFrame in its extended state though? I tried this.getSize().Height , this getSize().getHeight() and this.getHeight()? None of them work because they just return a value of 0. And what is the difference in all these statements in terms of what they do?
View Replies
View Related
Feb 9, 2015
On a web application i can take a pdf cut it and convert it to html. As a result of this is that i can have my own design(Background) on HTML and then use it on jsp.
Is there a way to do this also in swing ? take a pdf and convert it to jframe or something similar so that i can have my own frame design (Background)?
View Replies
View Related
Jul 16, 2014
I have one question that suppose I am designing a Swing applications and I am using JFrame as Top level container.
So what is best
1)first Extends that class like
public class A Extends JFrame
{
//Do all stuff with Top Level container with gui
}
2)Or design like this from this source
[URL] ....
package components;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/* TopLevelDemo.java requires no other files. */
public class TopLevelDemo {
/**
* Create the GUI and show it. For thread safety, this method should be invoked from the event-dispatching thread.
*/
private static void createAndShowGUI() {
//Create and set up the window.
[Code] .....
View Replies
View Related