TradingView Widget not loading on Android 6.0 - java

I'm developing an app with Tradingview widget on Android 6.0 (Marshmallow)
I am running the tradingview code in WebView but it is not showing the chart.
This is my TradingView Widget code;
WebView webView = findViewById(R.id.webviewer);
String symbol = getIntent().getStringExtra("symbol");
String interval = getIntent().getStringExtra("interval");
String data = "<!-- TradingView Widget BEGIN -->\n" +
"<div class=\"tradingview-widget-container\">\n" +
" <div id=\"tradingview_357eb\"></div>\n" +
" <div class=\"tradingview-widget-copyright\"><span class=\"blue-text\">"+symbol+" Chart</span></div>\n" +
" <script type=\"text/javascript\" src=\"https://s3.tradingview.com/tv.js\"></script>\n" +
" <script type=\"text/javascript\">\n" +
" new TradingView.widget(\n" +
" {\n" +
" \"width\": 300,\n" +
" \"height\": 200,\n" +
" \"symbol\": \"BINANCE:"+symbol+"\",\n" +
" \"interval\": \""+interval+"\",\n" +
" \"timezone\": \"Europe/Istanbul\",\n" +
" \"theme\": \"light\",\n" +
" \"style\": \"1\",\n" +
" \"locale\": \"en\",\n" +
" \"toolbar_bg\": \"#f1f3f6\",\n" +
" \"enable_publishing\": false,\n" +
" \"hide_side_toolbar\": false,\n" +
" \"save_image\": false,\n" +
" \"studies\": [\n" +
" \"BB#tv-basicstudies\",\n" +
" \"RSI#tv-basicstudies\",\n" +
" \"StochasticRSI#tv-basicstudies\"\n" +
" ],\n" +
" \"container_id\": \"tradingview_357eb\"\n" +
"}\n" +
" );\n" +
" </script>\n" +
"</div>\n" +
"<!-- TradingView Widget END -->";
webView.getSettings().setJavaScriptEnabled(true);
webView.loadData(data, "text/html", "utf-8");
I tried it on Android 8.0 and it works but not on 6.0. Why? Am I missing something?

Related

avoid adding the same element if exist in the list instead just add the elements inside the existing list [duplicate]

This question already has an answer here:
Add item to arraylist if it does not already exist in list
(1 answer)
Closed last year.
This post was edited and submitted for review last year and failed to reopen the post:
Original close reason(s) were not resolved
Below is the sample code
String jsonString = "{\n" +
" \"models\":[\n" +
" {\n" +
" \"model\":{\n" +
" \"code\":\"ALL\",\n" +
" \"type\":null,\n" +
" \"name\":\"ALL\",\n" +
" \"feature_types\":null\n" +
" }\n" +
" },\n" +
" {\n" +
" \"model\":{\n" +
" \"code\":\"102e\",\n" +
" \"defaultLookup\":\"false\",\n" +
" \"type\":\"SIT\",\n" +
" \"name\":\"MUSTANG\",\n" +
" \"feature_types\":[\n" +
" {\n" +
" \"feature_type\":{\n" +
" \"code\":\"A\",\n" +
" \"desc\":\"All feature types\"\n" +
" }\n" +
" },\n" +
" {\n" +
" \"feature_type\":{\n" +
" \"code\":\"B\",\n" +
" \"desc\":\"Series\"\n" +
" }\n" +
" },\n" +
" {\n" +
" \"feature_type\":{\n" +
" \"code\":\"C\",\n" +
" \"desc\":\"BodyStyle\"\n" +
" }\n" +
" }\n" +
" ]\n" +
" }\n" +
" },\n" +
" {\n" +
" \"model\":{\n" +
" \"code\":\"980p\",\n" +
" \"defaultLookup\":\"false\",\n" +
" \"type\":\"SIT\",\n" +
" \"name\":\"Ranger\",\n" +
" \"feature_types\":[\n" +
" {\n" +
" \"feature_type\":{\n" +
" \"code\":\"C\",\n" +
" \"desc\":\"All feature types\"\n" +
" }\n" +
" },\n" +
" {\n" +
" \"feature_type\":{\n" +
" \"code\":\"D\",\n" +
" \"desc\":\"Series\"\n" +
" }\n" +
" } \n" +
" ]\n" +
" }\n" +
" },\n" +
" {\n" +
" \"model\":{\n" +
" \"code\":\"kkpou\",\n" +
" \"defaultLookup\":\"false\",\n" +
" \"type\":\"UAT\",\n" +
" \"name\":\"Transit Custom\",\n" +
" \"feature_types\":[\n" +
" {\n" +
" \"feature_type\":{\n" +
" \"code\":\"F\",\n" +
" \"desc\":\"All feature types\"\n" +
" }\n" +
" },\n" +
" {\n" +
" \"feature_type\":{\n" +
" \"code\":\"G\",\n" +
" \"desc\":\"Series\"\n" +
" }\n" +
" },\n" +
" {\n" +
" \"feature_type\":{\n" +
" \"code\":\"H\",\n" +
" \"desc\":\"Payload\"\n" +
" }\n" +
" }\n" +
" ]\n" +
" }\n" +
" }\n" +
" ]\n" +
"}";
for(int i = 0; i<myData.size();i++)
{
String type = "SIT";
FeaturedItems item = resultList.stream().filter(featureItem -> type != null && type.equals(featureItem.getType())).findFirst().orElse(null);
if (type != null) {
item = FeaturedItems.builder().type(type).items(new ArrayList<>()).build();
resultList.add(item);//if the item already exists in the list don't add the new item, instead just add the elements in the exisiting item.
//tried the below commented code to add the item if it doesn't contain in the list -- start
/*boolean flagFound = false;
for (FeaturedItems featureItem : resultList) {
if (featureItem.getType().equalsIgnoreCase(type)) {
flagFound = true;
break;
}
}
if(!flagFound) resultList.add(item);*/
//tried the above commented code to add the item if it doesn't contain in the list -- End
for (int count = 0; count < features.size(); count++) {
String id = getFid(count);
MyDataBuild build = ....//logic to set values in the properties
item.getItems().add(build);
}
}
}
lookUpData.setFeatureGroups(resultList);
}
}
If the type value is already defined in the defined featureItems, then instead of creating the new object in the featureItems list, i need to add the unique items(desc,id) to the existing items element for the matching type. The code snippet mentioned above doesn't add the elements to the existing items if the type is matching in the featureItems list, instead it is creating the new element as shown in the output json sample.
Using a Map instead will make your live much easier. However your example is missing some data so it's a bit hard to understand what is actually happening in your code. So I can give you only a simple example for the usage.
Map<String, FeaturedItems> resultMap = new HashMap<>();
// Get the FeaturedItems for the given type. If none is present create a new one.
FeaturedItems items = resultMap.computeIfAbsent(type, k -> FeaturedItems.builder().type(k).items(new ArrayList<>()).build());
// Add your item to the list
Sale newItem // Obtain new item
items.getItems().add(newItem);

zoom leaflet according to circle size in it

I created an app that uses Leaflet in it.
In the screen where the map is, there is also a progressBar where I allow uses to search in a specific radius.
The moment they change the value in the progressBar, it changes the size of the circle marker inside the map.
I had like that my map will change its zoom to fit that circle in it.
My code for loading the map is:
String Map_HTML = "<html>\n" +
"<head>\n" +
"\n" +
" <title>Quick Start - Leaflet</title>\n" +
"\n" +
" <meta charset=\"utf-8\" />\n" +
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n" +
"\n" +
" <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"docs/images/favicon.ico\" />\n" +
"\n" +
" <link rel=\"stylesheet\" href=\"https://unpkg.com/leaflet#1.4.0/dist/leaflet.css\" integrity=\"sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA==\" crossorigin=\"\"/>\n" +
" <script src=\"https://unpkg.com/leaflet#1.4.0/dist/leaflet.js\" integrity=\"sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg==\" crossorigin=\"\"></script>\n" +
"\n" +
"\n" +
"\n" +
"<style>\n" +
"body {\n" +
"padding: 0;\n" +
"margin: 0;\n" +
"}\n" +
"html, body, #map {\n" +
"height: 100%;\n" +
"width: 100%;\n" +
"}\n" +
"</style>\n" +
"</head>\n" +
"<body>\n" +
"\n" +
"\n" +
"\n" +
"<div id=\"mapid\" style=\"width: " + dpWidth + "px; height: " + dpHeight * 0.3 + "px;\"></div>\n" +
"<script>\n" +
"\n" +
"var mymap = L.map('mapid',{zoomControl: false}).setView([" + Lat + ", " + Lon + "], 10);\n" +
"\n" +
" L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {\n" +
" minZoom: 7,\n" +
" maxZoom: 17,\n" +
" attribution: '© OpenStreetMap contributors' \n" +
" }).addTo(mymap);\n" +
"\n" +
"mymap.attributionControl.setPosition('topleft')\n" +
"L.control.zoom({\n" +
"position: 'bottomright'\n" +
"}).addTo(mymap);\n" +
"L.marker([" + Lat + ", " + Lon + "]).addTo(mymap)\n" +
" .bindPopup(\"<b>My Location</b>\").openPopup();\n" +
"\n" +
"L.circle([" + Lat + ", " + Lon + "], " + Radius + ", {\n" +
" color: 'red',\n" +
" fillColor: '#8275FE',\n" +
" fillOpacity: 0.4,\n" +
" weight: '0'\n" +
"}).addTo(mymap);\n" +
"\n" +
"\n" +
"var popup = L.popup();\n" +
"\n" +
"</script>\n" +
"\n" +
"</body>\n" +
"</html>";
where Radius is a parameter I insert based on the value of the progressBar.
Right now it always initializes the map with zoom: 10 because I don't know how to change it dynamically as I want.
Any way to do so?
Thank you
the map can fit to the bounds of the circle with mymap.fitBounds(circle.getBounds());.
Change your code to:
"var circle = L.circle([" + Lat + ", " + Lon + "], " + Radius + ", {\n" +
" color: 'red',\n" +
" fillColor: '#8275FE',\n" +
" fillOpacity: 0.4,\n" +
" weight: '0'\n" +
"}).addTo(mymap);\n" +
"mymap.fitBounds(circle.getBounds());\n" +

Selenium Webdriver | DragAndDrop Feature | No Exception, but code is not working

I'm trying to drag and drop and logo to an container, not getting exception. I'm able to find elements and the same drag and drop code is working fine for another site with other elements. But don't know why this is not working here. Can any one assist.
// Searching elements
driver.get(https://www.w3schools.com/html/tryit.asp?ilename=tryhtml5_draganddrop");
driver.switchTo().frame(driver.findElement(By.name("iframeResult")));
driver.manage().timeouts().implicitlyWait(10000, TimeUnit.MILLISECONDS);
WebElement From = driver.findElement(By.id("drag1"));
WebElement To = driver.findElement(By.id("div1"));
//Drag and Drop Action
Actions builder = new Actions(driver);
Action DragnDrop = builder.clickAndHold(From).moveToElement(To).release(To).build();
DragnDrop.perform();
Based on my experience to achieve more stable drag and drop actions we switched from Actions implementation to a javascript one. Yes, it might look like a hack, but constant false negatives of test result made us measure the risk and use the js impl. (We didn't create the script from scratch, just applied multiple suggestions found in the internet)
You can use it for your case, add the code below instead of Actions you used.
driver.executeScript("function dnd(elemDrag, elemDrop) {\n" +
" var DELAY_INTERVAL_MS = 100;\n" +
" var MAX_TRIES = 10;\n" +
" var dragStartEvent;\n" +
" if (!elemDrag || !elemDrop) {\n" +
" return false;\n" +
" }\n" +
" function fireMouseEvent(type, elem, dataTransfer) {\n" +
" var evt = document.createEvent('MouseEvents');\n" +
" evt.initMouseEvent(type, true, true, window, 1, 1, 1, 0, 0, false, false, false, false, 0, elem);\n" +
" if (/^dr/i.test(type)) {\n" +
" evt.dataTransfer = dataTransfer || createNewDataTransfer();\n" +
" }\n" +
" elem.dispatchEvent(evt);\n" +
" return evt;\n" +
" }\n" +
" function createNewDataTransfer() {\n" +
" var data = {};\n" +
" return {\n" +
" clearData: function (key) {\n" +
" if (key === undefined) {\n" +
" data = {};\n" +
" } else {\n" +
" delete data[key];\n" +
" }\n" +
" },\n" +
" getData: function (key) {\n" +
" return data[key];\n" +
" },\n" +
" setData: function (key, value) {\n" +
" data[key] = value;\n" +
" },\n" +
" setDragImage: function () {\n" +
" },\n" +
" dropEffect: 'none',\n" +
" files: [],\n" +
" items: [],\n" +
" types: []\n" +
" }\n" +
" }\n" +
" fireMouseEvent('mousedown', elemDrag);\n" +
" dragStartEvent = fireMouseEvent('dragstart', elemDrag);\n" +
" function dragover() {\n" +
" fireMouseEvent('dragover', elemDrop, dragStartEvent.dataTransfer);\n" +
" }\n" +
" function drop() {\n" +
" fireMouseEvent('drop', elemDrop, dragStartEvent.dataTransfer);\n" +
" fireMouseEvent('mouseup', elemDrop);\n" +
" fireMouseEvent('dragend', elemDrag);\n" +
" }\n" +
" setTimeout(dragover, DELAY_INTERVAL_MS);\n" +
" setTimeout(drop, DELAY_INTERVAL_MS * 2);\n" +
" return true;\n" +
"}\n" +
" dnd(arguments[0], arguments[1])", From, To)
Source: https://github.com/WileyLabs/teasy/blob/master/src/main/java/com/wiley/utils/JsActions.java
p.s. There is a typo in the link from your question. (instead of "asp?ilename" it should be "asp?filename)

How to drag & drop in specific position in selenium java?

I am trying to drag & drop 2 elements into my workspace but they are dropped over each other, how can i specify the position of dropping the elements?
I am using dragAndDrop() function
Actions act=new Actions(driver);
act.dragAndDrop(From, To).build().perform();
enter image description here
Using dragAndDrop() method you can perform drag and drop operations on only one location at a time. it is usually used to perform operations on web element which is capable of dropping. please find the reference http://demoqa.com/droppable/ for various types of dropable elements.
To implement drag and drop operation -
Example:
WebElement From=driver.findElement(By.xpath( <<source xpath>> ));
WebElement To=driver.findElement(By.xpath( <<destination xpath>> ));
Actions actions=new Actions(driver);
actions.dragAndDrop(From, To).build().perform();
to drag and drop another element, you need to perform above all steps again.
Hope this helps :)
Try Using below code :
public static void dragAndDropViaJQueryHelper(WebDriver driver, String dragSourceJQuerySelector, String dropTargetJQuerySelector) {
String jqueryScript = "(function( jquery ) {\r\n" +
" jquery.fn.simulateDragDrop = function(options) {\r\n" +
" return this.each(function() {\r\n" +
" new jquery.simulateDragDrop(this, options);\r\n" +
" });\r\n" +
" };\r\n" +
" jquery.simulateDragDrop = function(elem, options) {\r\n" +
" this.options = options;\r\n" +
" this.simulateEvent(elem, options);\r\n" +
" };\r\n" +
" jquery.extend(jquery.simulateDragDrop.prototype, {\r\n" +
" simulateEvent: function(elem, options) {\r\n" +
" /*Simulating drag start*/\r\n" +
" var type = 'dragstart';\r\n" +
" var event = this.createEvent(type);\r\n" +
" this.dispatchEvent(elem, type, event);\r\n" +
"\r\n" +
" /*Simulating drop*/\r\n" +
" type = 'drop';\r\n" +
" var dropEvent = this.createEvent(type, {});\r\n" +
" dropEvent.dataTransfer = event.dataTransfer;\r\n" +
" this.dispatchEvent(jquery(options.dropTarget)[0], type, dropEvent);\r\n" +
"\r\n" +
" /*Simulating drag end*/\r\n" +
" type = 'dragend';\r\n" +
" var dragEndEvent = this.createEvent(type, {});\r\n" +
" dragEndEvent.dataTransfer = event.dataTransfer;\r\n" +
" this.dispatchEvent(elem, type, dragEndEvent);\r\n" +
" },\r\n" +
" createEvent: function(type) {\r\n" +
" var event = document.createEvent(\"CustomEvent\");\r\n" +
" event.initCustomEvent(type, true, true, null);\r\n" +
" event.dataTransfer = {\r\n" +
" data: {\r\n" +
" },\r\n" +
" setData: function(type, val){\r\n" +
" this.data[type] = val;\r\n" +
" },\r\n" +
" getData: function(type){\r\n" +
" return this.data[type];\r\n" +
" }\r\n" +
" };\r\n" +
" return event;\r\n" +
" },\r\n" +
" dispatchEvent: function(elem, type, event) {\r\n" +
" if(elem.dispatchEvent) {\r\n" +
" elem.dispatchEvent(event);\r\n" +
" }else if( elem.fireEvent ) {\r\n" +
" elem.fireEvent(\"on\"+type, event);\r\n" +
" }\r\n" +
" }\r\n" +
" });\r\n" +
"})(jQuery);";
((JavascriptExecutor) driver).executeScript(jqueryScript);
String dragAndDropScript = "jQuery('" + dragSourceJQuerySelector + "').simulateDragDrop({ dropTarget: '" + dropTargetJQuerySelector + "'});";
((JavascriptExecutor) driver).executeScript(dragAndDropScript);
}
Just pass css or xpath selectors in parameters.
Hope that helps you.
If that does not help you I can help you out with some other solutions also.

HTML Table formatting using css not working in JTextPane

I am trying to implement a view only HTML pane for some specific project. I am using JTextPane to render HTML using content type as "text/html". I was having tables in my input HTML so in order to give these tables border, i thought of using css styling, but unfortunately it did not work out.
If I put border property as part of table itself then it works but not
with css styling.
Here is the sample code i created to recreate issue. content1 does not creates border for my table but content2 creates it. I want to use content1 approach as i have plenty of html files with tables. Thanks for your time, any help will be much appreciated.
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
public class TestTextPane {
private static int X = 200;
private static int Y = 200;
private static int W = 600;
private static int H = 400;
public static final String content1 = "<html>\r\n" +
" <head>\r\n" +
" <style type=\"text/css\">\r\n" +
" <!--\r\n" +
" table,th, td { border: 1px solid black }\r\n" +
" body, p { font-family: Courier; font-size: 14 }\r\n" +
" -->\r\n" +
" </style>\r\n" +
" \r\n" +
" </head>\r\n" +
" <body>\r\n" +
" <div align=\"left\">\r\n" +
" <b>Q: What is the difference between GET and POST method? </b>\r\n" +
" </div>\r\n" +
" <p>\r\n" +
" A:\r\n" +
" </p>\r\n" +
" <table>\r\n" +
" <tr>\r\n" +
" <th width=\"50%\">\r\n" +
" GET\r\n" +
" </th>\r\n" +
" <th>\r\n" +
" POST\r\n" +
" </th>\r\n" +
" </tr>\r\n" +
" <tr>\r\n" +
" <td>\r\n" +
" GET is a safe method (idempotent)\r\n" +
" </td>\r\n" +
" <td>\r\n" +
" POST is non-idempotent method\r\n" +
" </td>\r\n" +
" </tr>\r\n" +
" <tr>\r\n" +
" <td>\r\n" +
" We can send limited data with GET method and it’s sent in the header \r\n" +
" request URL\r\n" +
" </td>\r\n" +
" <td>\r\n" +
" we can send large amount of data with POST because it’s part of the \r\n" +
" body.\r\n" +
" </td>\r\n" +
" </tr>\r\n" +
" </table>\r\n" +
" <br>\r\n" +
" <br>\r\n" +
" \r\n" +
" </body>\r\n" +
"</html>";
public static final String content2 = "<html>\r\n" +
" <head>\r\n" +
" <style type=\"text/css\">\r\n" +
" <!--\r\n" +
" body, p { font-family: Courier; font-size: 14 }\r\n" +
" -->\r\n" +
" </style>\r\n" +
" \r\n" +
" </head>\r\n" +
" <body>\r\n" +
" <div align=\"left\">\r\n" +
" <b>Q: What is the difference between GET and POST method? </b>\r\n" +
" </div>\r\n" +
" <p>\r\n" +
" A:\r\n" +
" </p>\r\n" +
" <table border=1>\r\n" +
" <tr>\r\n" +
" <th width=\"50%\">\r\n" +
" GET\r\n" +
" </th>\r\n" +
" <th>\r\n" +
" POST\r\n" +
" </th>\r\n" +
" </tr>\r\n" +
" <tr>\r\n" +
" <td>\r\n" +
" GET is a safe method (idempotent)\r\n" +
" </td>\r\n" +
" <td>\r\n" +
" POST is non-idempotent method\r\n" +
" </td>\r\n" +
" </tr>\r\n" +
" <tr>\r\n" +
" <td>\r\n" +
" We can send limited data with GET method and it’s sent in the header \r\n" +
" request URL\r\n" +
" </td>\r\n" +
" <td>\r\n" +
" we can send large amount of data with POST because it’s part of the \r\n" +
" body.\r\n" +
" </td>\r\n" +
" </tr>\r\n" +
" </table>\r\n" +
" <br>\r\n" +
" <br>\r\n" +
" \r\n" +
" </body>\r\n" +
"</html>";
/**
* #param args
*/
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setBounds(X, Y, W, H);
JTextPane pane = new JTextPane();
pane.setContentType("text/html");
pane.setEditable(false);
JScrollPane scrollPane = new JScrollPane(pane);
scrollPane.setBounds(X,Y,W,H);
frame.getContentPane().add(scrollPane);
pane.setText(content2); // change content here
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
I removed the comment notation from the style and added units for the size of the font.
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
public class TestTextPane {
private static int X = 200;
private static int Y = 200;
private static int W = 600;
private static int H = 400;
public static final String content1 = "<html>\r\n" +
" <head>\r\n" +
" <style type=\"text/css\">\r\n" +
" table, th, td { border: 2px solid #FF0000; }\r\n" +
// be sure to add a unit to the font size, otherwise it is invalid
" body, p { font-family: Courier; font-size: 14px; }\r\n" +
" </style>\r\n" +
" \r\n" +
" </head>\r\n" +
" <body>\r\n" +
" <div align=\"left\">\r\n" +
" <b>Q: What is the difference between GET and POST method? </b>\r\n" +
" </div>\r\n" +
" <p>\r\n" +
" A:\r\n" +
" </p>\r\n" +
" <table>\r\n" +
" <tr>\r\n" +
" <th width=\"50%\">\r\n" +
" GET\r\n" +
" </th>\r\n" +
" <th>\r\n" +
" POST\r\n" +
" </th>\r\n" +
" </tr>\r\n" +
" <tr>\r\n" +
" <td>\r\n" +
" GET is a safe method (idempotent)\r\n" +
" </td>\r\n" +
" <td>\r\n" +
" POST is non-idempotent method\r\n" +
" </td>\r\n" +
" </tr>\r\n" +
" <tr>\r\n" +
" <td>\r\n" +
" We can send limited data with GET method and it’s sent in the header \r\n" +
" request URL\r\n" +
" </td>\r\n" +
" <td>\r\n" +
" we can send large amount of data with POST because it’s part of the \r\n" +
" body.\r\n" +
" </td>\r\n" +
" </tr>\r\n" +
" </table>\r\n" +
" <br>\r\n" +
" <br>\r\n" +
" \r\n" +
" </body>\r\n" +
"</html>";
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setBounds(X, Y, W, H);
JTextPane pane = new JTextPane();
pane.setContentType("text/html");
pane.setEditable(false);
JScrollPane scrollPane = new JScrollPane(pane);
scrollPane.setBounds(X,Y,W,H);
frame.getContentPane().add(scrollPane);
pane.setText(content1); // change content here
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
This is what I tried for content1 and its working fine.
I added this line
body table { border: 1px solid red }
sample code:
public static final String content1 = "<html>\r\n"
+ " <head>\r\n"
+ " <style type=\"text/css\">\r\n"
+ " <!--\r\n"
+ " table, th, td { border: 1px solid black }\r\n"
+ " body table { border: 1px solid red }\r\n"
+ " body, p { font-family: Courier; font-size: 14; }\r\n"
+ " -->\r\n"
+ " </style>\r\n"
I tried all the above solutions but unfortunately any of these did not work for me. I was searching for the solution and i got into this post
And i tried table, th, td { border-width: 1px solid black } voila it worked for me. I dont know why the plain border property did not work for me but it worked for others.
Thanks a lot for all you help Guys.

Categories

Resources