473,804 Members | 2,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

exporting non-public type through public api

8 New Member
I have this code and for some reason I keep getting an error where it says "exporting non-public type through public api ".. I'm not sure why this keeps happening but it does so for getCircleInfo / drawCircle. Thanks for your help.

- Me.

Expand|Select|Wrap|Line Numbers
  1. package shapemaker;
  2.  
  3. import java.awt.*;
  4. import javax.swing.*;
  5.  
  6. public class ShapeMaker {
  7.  
  8.     private JFrame win;
  9.     private Container contentPane;
  10.  
  11.     public ShapeMaker (  ) {
  12.         win = new JFrame("Shape Maker");
  13.         win.setSize(400, 300);
  14.         win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  15.         win.setVisible(true);
  16.         contentPane = win.getContentPane();
  17.         contentPane.setBackground(Color.WHITE);
  18.     }
  19.  
  20.     public static void main(String[] args) {
  21.         ShapeMaker shapeMaker = new ShapeMaker();
  22.         shapeMaker.start();
  23.     }
  24.  
  25.     public void start (  ) {
  26.         Circle circle = new Circle (  );
  27.         getCircleInfo(circle);
  28.         drawCircle(circle);
  29.     }
  30.  
  31.     public void getCircleInfo ( Circle circle ) {
  32.         double radius;
  33.         int x, y;
  34.         radius = Double.parseDouble ( JOptionPane.showInputDialog (win, "Enter Radius") );
  35.         circle.setRadius(radius);
  36.         circle.setFillColor(Color.orange);
  37.         circle.setPenColor(Color.black);
  38.         x = Integer.parseInt( JOptionPane.showInputDialog ( win, "Enter X Cord:" ) );
  39.         circle.setXCord(x);
  40.         y = Integer.parseInt( JOptionPane.showInputDialog ( win, "Enter Y Cord:" ) );
  41.         circle.setYCord(y);
  42.     }
  43.  
  44.     public void drawCircle ( Circle circle ) {
  45.         Graphics g = contentPane.getGraphics();
  46.         circle.draw(g);
  47.     }
  48. }
Feb 21 '09
14 14528
DeadSilent
8 New Member
LOL! Sorry about that, I got confused for a second.
Feb 23 '09 #11
Yarn
1 New Member
For the exporting non-public type through public API thing, try making the method headings just void getCircleInfo ( Circle circle ) and void drawCircle ( Circle circle ). Take away the publics. Because every class in the program is part of one package, all the classes should be able to access the methods and fields from all other classes in the package even if the methods and fields have no public-private declaration. So this should work, because it gets rid of the public API, but still allows all classes access. I'm not sure exactly why all this happens, but I get the same thing with NetBeans when I try to use certain classes as parameters. I've found that this usually makes the IDE shut up. I've used other compilers/editors (i.e.) JCreator and this seems to be a problem specific to NetBeans. As for the paintComponent( ) method, chances are that it is in one of those collapsed sections of uneditable text that are generated by the design panel.
Mar 4 '09 #12
ZRJavelin
3 New Member
The warning is coming from your line five (5): the class Circle has no designation [i.e. public, private, etc];

Make it public and warning will disappear.
Mar 27 '09 #13
ZRJavelin
3 New Member
As to your other issues, only Classes should be capitalized; for the sake of future debugging efforts, change your variables [like Radius to 'radius'] to lower-case, so in-code references do not imply it is a reference to a static Class.
Mar 27 '09 #14
ZRJavelin
3 New Member
Based on your codes:
// Constructors
public Circle ( ) {
//setRadius(0);
this(0);
}

public Circle ( double r ) {
setRadius(r);
penColor = Color.BLACK;
fillColor = Color.WHITE;
XCord = 0;
YCord = 0;
}
and from shapemaker

public void start ( ) {
Circle circle = new Circle ( );
getCircleInfo(c ircle);
drawCircle(circ le);
}
Your constructor for a Circle requires a radius parameter; your default is 0 and no other value is passed; I contend you ARE drawing a circle, though one of radius = 0, at coords (0,0).
Mar 27 '09 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1985
by: Angel Cat | last post by:
I'm exporting a large file from a large Production database (SQL). Users are currently updating and inserting new records. Does the export take a snapshot of the data when it starts ? or will it freeze the database so all udpates/inserts happen after the export completes? Also, how do I get the delta of data that wasn't exported, if I want to get the difference the next day?
3
9250
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works only exporting to single worksheet. but i need to export data to multiple worksheets. it is very urgent to us. so please help me in code.
1
7496
by: Janne Ruuttunen | last post by:
Hello DB2 people, I'm having problems exporting >= 250000 lobs to IXF files with the LOBSINFILE option, using a legacy DB2 2.1 system on Win NT. If I don't specify a path for the lobs, defining more than 250 base names for the lobs leads to an error message something like "DB2 encountered an unexpected error when sending the query to the backend process" (I don't have the exact message at hand). It doesn't matter how short the base...
0
1345
by: Mike P | last post by:
I'm exporting a datagrid to excel, but I can't get non-English characters such as ö, ä and å to appear properly in the Excel document (they are fine on my webpage). Here is my code : Response.Clear(); Response.Buffer = true; Response.ContentType = "application/vnd.ms-excel"; Response.Charset = "iso-8859-1"; this.EnableViewState = false;
1
3172
by: Mustufa Baig | last post by:
I have an ASP.NET website where I am showing off crystal reports to users by exporting them to pdf format. Following is the code: ---------------- 1 Private Sub ExportReport() 2 Dim oStream As System.IO.MemoryStream = 3 myReport.ExportToStream( ExportFormatType.PortableDocFormat) 4 Response.Clear() 5 Response.Buffer() = True
7
1897
by: victorsk | last post by:
Hello, I have a dll which I compiled in VB. Now I would like to use this dll in MapBasic program. However, I keep getting an error saying that the function which I am calling cannong be found. After doing some research, I learned that VB's functions are not exportable and suggestion is to get PowerBasic or XBasic. I am just starting with VB so I am not sure if I am right, but can somebody please tell me if I can make exportable...
2
2416
by: bienwell | last post by:
Hi, I have a question about exporting data from datagrid control into Excel file in ASP.NET. On my Web page, I have a linkbutton "Export data". This link will call a Sub Function to perform exporting ALL data from the datagrid control. Exporting data works fine when I show all data on the datagrid control. I'd like to shows only 30 records on the datagrid control instead of ALL data using page navigation, and perform exporting...
2
3188
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to set this up so as to do it reliably and minimize overhead? There are currently no constraints on the destination table. Assume the user or some configuration specifies the database name, server name, and filename+fullpath. The server is SQL...
0
1718
by: =?Utf-8?B?ZGVuIDIwMDU=?= | last post by:
hi, I trying to export data display on a gridview that supports any language (like chinese, japanese, thai, french) shown here is chinese only. There is no problem exporting english language data, problem starts exporting non-english data using approach shown below, the data is retrieve in database in an xml format. Is there a simple way to be able to make this work? Response.ContentEncoding = System.Text.Encoding.UTF8;
1
4917
by: Marty Klunk | last post by:
I have an Access97 data base where we are exporting records out to a text file that is then sent to a customer via EDI transmission. The problem I am having is that during the export process access is converting my number fields to scientific notation and they are getting bounced by our customer's EDI program. Example is .0027 is showing in the text file as 2.7E-3. I have tried setting formatting to fixed with 4 decimals, general with 4, no...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.